akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<cstdio>
using namespace std;

int main(void){
   int a, b;
   cin >> a;       //aによむ
   cin >> b;       //bによむ
   if (a<b){
       cout << "a < b";
   }
   else if (a>b){
       cout << "a > b";
   }
   else {
       cout << "a == b";
   }
   cout << endl;
}


Measured memory_bytes: 3084
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int s;
string str;
int main(){
	cin>>str;
	for(int i=0;i<str.size();i++){
		if(str[i]=='C') s=1;
		if(str[i]=='F'&&s==1) {
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 256
a = input().split()
h = int(a[0])
w = int(a[1])

m = []
for i in range(h):
	sb = input()
	if not  sb == '.'*w:
		m.append(sb)
			
if not m == []:
	output = [[] for i in range(len(m))]
	for i in range(len(m[0])):
		notok = True
		for j in range(len(m)):
			notok = notok and (m[j][i] == '.')
			if notok == False:
				break
		if notok == False:
			for j in range(len(m)):
				output[j].append(m[j][i])
				
for i in range(len(output)):
	print(''.join(output[i]))
	


Measured memory_bytes: 39792
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi b(n-1); for(auto& e : b) cin >> e;

    int res = b[0] + b.back();
    rep(i, n-2){
        res += min(b[i], b[i+1]);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;

class UnionFind {
public:
  vector<int> data; // sizeとparを同時に管理する
  UnionFind(int size) : data(size, -1) {}

  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }

  void unite(int x, int y) {
    int px = find(x);
    int py = find(y);
    if (px != py) {
      if (data[py] < data[px]) swap(px, py);
      data[px] += data[py]; data[py] = px;
    }
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  int size(int x) {
    return -data[find(x)];
  }
};

struct Edge {
  int cost, from, to;
  Edge() {}
  Edge(int c, int f, int t) : cost(c), from(f), to(t) {}
  friend bool operator < (const Edge& lhs, const Edge& rhs) { return lhs.cost < rhs.cost; };
  friend bool operator > (const Edge& lhs, const Edge& rhs) { return rhs < lhs; };
  friend bool operator <= (const Edge& lhs, const Edge& rhs) { return !(lhs > rhs); };
  friend bool operator >= (const Edge& lhs, const Edge& rhs) { return !(lhs < rhs); };
};

struct MinimumSpanningTree {
  struct UnionFind uf;
  uint64_t weight; // 最小全域木の辺の重みの和
  MinimumSpanningTree(int V, vector<Edge> &edges) : uf(V), weight(0) {
    sort(edges.begin(), edges.end());
    for (auto e : edges) { 
      if (uf.same(e.from, e.to)) continue;
      uf.unite(e.from, e.to);
      weight += e.cost;
    }
  }
};

typedef tuple<int, int, int> pos_t;

int main() {
  int n;
  cin >> n;
  vector<pos_t> lp;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    lp.emplace_back(i, x, y);
  }
  vector<Edge> edges;
  // xの昇順にsort
  sort(lp.begin(), lp.end(),
       [](pos_t const &lhs, pos_t const &rhs) { 
         return get<1>(lhs) < get<1>(rhs);
       }
  );
  for (int i = 0; i < lp.size()-1; ++i) { 
    int fid, fx, fy;
    int tid, tx, ty;
    tie(fid, fx, fy) = lp[i];
    tie(tid, tx, ty) = lp[i+1];
    edges.emplace_back(tx-fx, fid, tid);
  }

  // yの昇順にsort
  sort(lp.begin(), lp.end(),
       [](pos_t const &lhs, pos_t const &rhs) { 
         return get<2>(lhs) < get<2>(rhs);
       }
  );
  for (int i = 0; i < lp.size()-1; ++i) { 
    int fid, fx, fy;
    int tid, tx, ty;
    tie(fid, fx, fy) = lp[i];
    tie(tid, tx, ty) = lp[i+1];
    edges.emplace_back(ty-fy, fid, tid);
  }

  MinimumSpanningTree mst(n, edges);
  cout << mst.weight << endl;

}

Measured memory_bytes: 6132
#include <iostream>

int main()
{
    int A,B,C,K;
    std::cin >> A >> B >> C >> K;

    int count=0;
    if(K > A){
        count = A;
        for(int i=0;i<K-A-B;i++)
            count--;
    }
    else
        count = K;
    

    std::cout << count << std::endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;
    
    ll N; cin >> N;
    ll a;
    ll jj = 0;

    rep(i,N){
        cin >> a;
        ll j=0;
        for (ll k = 1; k <= sqrt(a); ++k) {
            if (a % k == 0) {
                ++j;
            }
        }
        if (j == 1) {
            ++jj;
        }
    }

    cout << jj << endl;

}


Measured memory_bytes: 3220
s = input()
pair = [[1,0]]
tmp = "R"
for i in range(1,len(s)):
  if s[i]=="R":
    if s[i]!=s[i-1]:
      pair.append([0,0])
    pair[-1][0]+=1
  else:
    pair[-1][1]+=1
ans = []
for p in pair:
  for _ in range(p[0]-1):
    ans.append(0)
  if p[0]==p[1]:
    ans.append(p[0])
    ans.append(p[1])
  elif (p[0]+p[1])%2==0:
    ans.append((p[0]+p[1])//2)
    ans.append((p[0]+p[1])//2)
  elif p[0]>p[1]:
    if p[0]%2!=0:
      ans.append((p[0]+p[1]+1)//2)
      ans.append((p[0]+p[1]-1)//2)
    else:
      ans.append((p[0]+p[1]-1)//2)
      ans.append((p[0]+p[1]+1)//2)
  elif p[0]<p[1]:
    if p[1]%2!=0:
      ans.append((p[0]+p[1]-1)//2)
      ans.append((p[0]+p[1]+1)//2)
    else:
      ans.append((p[0]+p[1]+1)//2)
      ans.append((p[0]+p[1]-1)//2)
  for _ in range(p[1]-1):
    ans.append(0)
print(*ans, sep=" ")

Measured memory_bytes: 11412
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll f[1000100], finv[1000100];

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

ll modinv(ll a) {
  return modpow(a, mod - 2);
}

ll nCr(ll n, ll r) {
  if (r < 0 || r > n) return 0;
  return f[n] * finv[n - r] % mod * finv[r] % mod;
}

ll nHr(ll n, ll r) {
  return nCr(n + r - 1, r);
}

void init() {
  f[0] = 1, finv[0] = 1;
  FOR(i, 1, 1000100) {
    f[i] = i * f[i - 1] % mod;
    finv[i] = modinv(f[i]);
  }
}


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  init();

  ll n, m;
  cin >> n >> m;

  ll ans = 0;
  rep(i, n + 1) {
    ll res = nCr(m, i) * nCr(m - i, n - i) % mod * nCr(m - i, n - i) % mod * f[n] % mod * f[n - i] % mod;
    if (i & 1) ans = (ans - res + mod) % mod;
    else ans = (ans + res) % mod;
  }
  cout << ans << '\n';

  




  
  return 0;
}

Measured memory_bytes: 19276
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

int main(){
	dhoom;
	int n;
	cin >> n;
	int a[n];
	for(int i = 1 ; i <= n ; i++)
		cin >> a[i];
	int ans = 9999999;
	for(int i = 1 ; i <= 100 ; i++){
			int cnt = 0;
			for(int j = 1 ; j <= n ; j++){
					cnt += ((i - a[j])*(i - a[j]));		
			}
			ans = min(ans , cnt );
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
if isfile("in.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
function main()
  s=chomp(readline())
  c0=0
  c1=0
  for i=s;i=='0' ? c0+=1 : c1+=1;end
  print(min(c0,c1)*2)
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


Measured memory_bytes: 169440
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int a[4];
string s;
int main(){
    cin>>s;
    for(int i=0;i<s.size();++i){
        if(s[i]=='S')a[0]=1;
        else if(s[i]=='N')a[1]=1;
        else if(s[i]=='W')a[2]=1;
        else a[3]=1;
    }
    if(a[0]+a[1]==1||a[2]+a[3]==1)puts("No");
    else puts("Yes");
    //system("pause");
    return 0;
}


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

using namespace std;

typedef long long ll;

int main(){ 
  int N; cin >> N;
  
  double ans = 10010010;
  
  vector<double> x(N),y(N);
  
  for(int i = 0; i < N; i++){ cin >> x[i] >> y[i];}
  
  if( N >= 3){
  for(int i = 0; i < N-2; i++){ 
    for(int j = i+1; j < N-1; j++){
       for(int k = j+1; k < N; k++){ // 3点i,j,kを通る円の外接円について
         
         double x1 = x[j]-x[i],y1 = y[j]-y[i];
         double x2 = x[k]-x[i],y2 = y[k]-y[i];
         
         if( x1*y2-x2*y1 == 0.0 ){ 
           //外積が0 →　全て同一直線上にあり
           continue;
         }
         
       
         double x0 = y1*y2*(y2-y1)+y1*x2*x2-y2*x1*x1;
         x0 /= 2*(x2*y1-x1*y2);
         double y0 = (-x1/y1)*(x0-x1/2)+y1/2;
         
         x0 += x[i];
         y0 += y[i];
         
         // 中心点が決定
         
         bool flag = true;
         
         double r = sqrt( pow(x0-x[i], 2.0) + pow(y0-y[i], 2.0) );
         
         for(int p = 0; p < N; p++){ 
           
           if( p == i || p == j || p == k){ continue;}
           
           double dist = sqrt( pow( x0-x[p], 2.0 ) + pow( y0-y[p], 2.0 ) );
           
           if( dist > r ){ flag = false; break;}
           
         }
         
         if(flag){ ans = min(ans, r);}
         
         
       }
    }
  }
  }
  
  //次に直径パターン
  
  for(int i = 0; i < N-1; i++){ 
    for(int j = i+1; j < N; j++){ 
      
      double x0 = (x[i]+x[j])/2;
      double y0 = (y[i]+y[j])/2;
      
      double r = sqrt( pow(x[i]-x0, 2.0) + pow(y[i]-y0, 2.0) );
      
      bool flag = true;
      
      for(int k = 0; k < N; k++){ 
        
        if( k == i || k == j ){ continue;}
        
        double dist = sqrt( pow( x[k]-x0, 2.0 ) + pow( y[k]-y0 , 2.0 ) );
        
        if( dist > r ){ flag = false;}
        
      }
      
      if( flag ){ ans = min(ans,r);}
      
    }
  }

  printf("%.8f\n", ans);
  
  return 0;
}
                 
           

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    int k, x;
    cin >> k >> x;
    if (500 * k >= x)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var S string
	fmt.Scan(&S)
	min := 999
	for i := 0; i < len(S)-2; i++ {
		w, _ := strconv.ParseFloat(S[i:i+3], 32)
		wm := math.Abs(753 - w)
		if int(wm) < min {
			min = int(wm)
		}
	}
	fmt.Println(min)
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<pair<pair<int, int>, int>> LR_l(N), LR_r(N);
    rep(i, N) {
        cin >> LR_l[i].first.first >> LR_l[i].first.second;
        LR_l[i].second = i;
        LR_r[i] = LR_l[i];
    }
    vector<bool> used(N);

    sort(all(LR_l), [](auto& l, auto& r) { return l.first.first < r.first.first; });
    sort(all(LR_r), [](auto& l, auto& r) { return l.first.second < r.first.second; });

    ll ans1 = 0;
    int x1 = 0;
    for (int il = N - 1, ir = 0; il >= 0 && ir < N; ) {
        while (il >= 0 && used[LR_l[il].second]) il--;
        if (il < 0) break;
        if (LR_l[il].first.first <= x1) break;

        ans1 += LR_l[il].first.first - x1;
        x1 = LR_l[il].first.first;
        used[LR_l[il].second] = true;
        il--;

        while (ir < N && used[LR_r[ir].second]) ir++;
        if (ir >= N) break;
        if (LR_r[ir].first.second >= x1) break;

        ans1 += x1 - LR_r[ir].first.second;
        x1 = LR_r[ir].first.second;
        used[LR_r[ir].second] = true;
        ir++;
    }
    ans1 += abs(x1);

    used.assign(N, false);

    ll ans2 = 0;
    int x2 = 0;
    for (int il = N - 1, ir = 0; ; ) {
        while (ir < N && used[LR_r[ir].second]) ir++;
        if (ir >= N) break;
        if (LR_r[ir].first.second >= x2) break;

        ans2 += x2 - LR_r[ir].first.second;
        x2 = LR_r[ir].first.second;
        used[LR_r[ir].second] = true;
        ir++;

        while (il >= 0 && used[LR_l[il].second]) il--;
        if (il < 0) break;
        if (LR_l[il].first.first <= x2) break;

        ans2 += LR_l[il].first.first - x2;
        x2 = LR_l[il].first.first;
        used[LR_l[il].second] = true;
        il--;
    }
    ans2 += abs(x2);

    write(max(ans1, ans2));
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    int n, h, w;
    cin >> n >> h >> w;
    cout << (n - h + 1) * (n - w + 1) << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll MOD = 1000000007;
ll mod_pow(ll a, ll n, ll mod) {
    ll res = 1, p = a % mod;
    while (n) {
        if (n & 1) res = res * p % mod;
        p = p * p % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, k;
    cin >> n >> m >> k;

    vector<ll> fact(n * m);
    fact[0] = 1;
    for (ll i = 1; i < n * m; ++i) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }

    ll ans = 0;
    rep(i, m) { (ans += i * (m - i) * n * n) %= MOD; }
    rep(i, n) { (ans += i * (n - i) * m * m) %= MOD; }
    (ans *= fact[n * m - 2]) %= MOD;
    (ans *= mod_pow(fact[n * m - k], MOD - 2, MOD)) %= MOD;
    (ans *= mod_pow(fact[k - 2], MOD - 2, MOD)) %= MOD;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#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; }

int main(){
    string s; cin >> s;
    reverse(s.begin(), s.end());

    bool flg = true;
    for(int i=0; i<s.size(); i++){
        if(s[i] == 'm'){
            string cmp = "maerd";
            for(int t=i; t<i+5; t++){
                if(s[t] != cmp[t-i]){
                    flg = false;
                }
            }
            i += 4;
        }
        else if(s[i] == 'e'){
            string cmp = "esare";
            for(int t=i; t<i+5; t++){
                if(s[t] != cmp[t-i]){
                    flg = false;
                }
            }
            i += 4;
        }
        else if(s[i] == 'r' && s[i+2] == 'm'){
            string cmp = "remaerd";
            for(int t=i; t<i+7; t++){
                if(s[t] != cmp[t-i]) flg = false;
            }
            i += 6;
        }
        else if(s[i] == 'r' && s[i+2] == 's'){
            string cmp = "resare";
            for(int t=i; t<i+6; t++){
                if(s[t] != cmp[t-i]) flg = false;
            }
            i += 5;
        }
    }

    if(flg) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9+7
typedef long long int ll;
const int maxn = 1000000;

ll mod = INF;

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    ll ans=0;
    map<ll,ll> m;
    for(int i=0;i<(int)s.size();i++){
        int num=(int)s[i]-(int)'a';
        m[num]++;
    }
    int single=0;
    vector<int> multi;
    for(int i=0;i<26;i++){
        if(m[i]>1){
            multi.push_back(m[i]);
        }else if(m[i]==1){
            single++;
        }
    }
    for(int i=0;i<single;i++){
        if(i==0)ans=1;
        ans=(ans*2)%mod;
    }
    if(ans==0)ans=1;
    for(int i=0;i<(int)multi.size();i++){
        ans=(ans*(multi[i]+1))%mod;
    }
    cout << ans-1<<endl;
    return 0;
}

Measured memory_bytes: 3696
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>

int readint()
{
	char c;
	while(c=getchar(),(c<'0'||c>'9')&&c!='-');
	bool flag=(c=='-');
	if(flag)c=getchar();
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=x*10+c-48;
		c=getchar();
	}
	return flag?-x:x;
}

const int mod=1e9+7;
ll ans;
int a,b;

ll mult(int x){
	ll res=1;
	REP(i,x)res=(res*(ll)i)%mod;
	return res;
}

int main(){
	cin>>a>>b;
	if(abs(a-b)>1){
		cout<<0;
		return 0; 
	}
	if(a==b){
		ll m=mult(a);
		cout<<m*m%mod*2%mod;
	}
	else{
		ll m1=mult(a),m2=mult(b);
		cout<<m1*m2%mod;
	}
	return 0;
}

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

int main() {      
	int N, Sum, F;
	cin >> N;
    F = N;
  	Sum = 0;
	while (N != 0) {
    	Sum = Sum + (N % 10);
    	N = N / 10;
	}
	if (F % Sum == 0){
    	cout << "Yes" << endl;
    }
	else{
    	cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,K;
    cin >> N >> K;
    vector<int>P(N);
    vector<int>C(N);
    for(int i = 0; i < N; i++) {
        cin >> P[i];
        P[i]--;
    }
    for(int i = 0; i < N; i++) {
        cin >> C[i];
    }
    int ans = -INF;
    for(int i = 0; i < N; i++) {
        int now = i;
        int res = 0,sum = 0;
        int mx = -INF;
        while(true) {
            int nx = P[now];
            sum += C[nx];
            res++;
            mx = max(mx,sum);
            if(nx == i) {
                break;
            }
            now = nx;
        }
        if(sum <= 0) {
            ans = max(ans,mx);
        }
        else {
            if(K/res > 1) {
                ans = max(ans,(K/res-1)*sum+mx);
            }
            int time = K%res;
            now = i;mx = 0;
            int MAX = -INF;
            while(time--) {
                int nx = P[now];
                mx += C[nx];
                MAX = max(MAX,mx);
                now = nx;
            }
            if(MAX < 0) {
                ans = max(ans,K/res*sum);
            }
            else {
                ans = max(ans,K/res*sum+MAX);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3712
#include <stdio.h>
 
long long a[100005];
 
int main() {
    int n; scanf("%d", &n);
    long long mx = 1e18, ans = 1;
    for (int i = 0; i < n; i++) {
        scanf("%lld", a + i);
        if (a[i] == 0) ans = 0;
    }
    if (ans) {
        for (int i = 0; i < n; i++) {
            if (a[i] > mx) {
                ans = -1;
                break;
            }
            ans *= a[i], mx /= a[i];
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 2508
import java.util.Scanner;

public class Main {
	static boolean isPrime[] = new boolean[50001];
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	while(input.hasNext()){
    		int a = input.nextInt();
    		System.out.println(senhiki(a));
    	}
    }
    
    public static int senhiki(int a){
    	return (a*a+a+2)/2;
    }
}

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int fib[INF];

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

  fib[0] = fib[1] = 1;
  for (int i = 2; i <= n; i++){
    fib[i] = fib[i - 1] + fib[i - 2];
  }
  cout << fib[n] << endl;
}

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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

int main() {
    int n;
    cin>>n;
    map<string,int>mp;
    ii {
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
}

Measured memory_bytes: 3600
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

min_dst = 10**9
ans = 0

for i in range(N):
    dst = abs(A - (T - H[i] * 0.006 ) )
    if min_dst > dst:
        min_dst = dst
        ans = i + 1
print(ans)

Measured memory_bytes: 3064
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

f [n,w,l,d] = (n, 3 * read w + read d)
g (n,s) = n ++ "," ++ show s

main = main' False

main' b = do
    n <- getInt
    when (n/=0) $ when b (putStrLn "") >> replicateM n getLine >>= mapM_ (putStrLn . g) . sortBy (flip $ on compare snd) . map (f . words) >> main' True

Measured memory_bytes: 4100
def bunkai(x):
    x_set = set()
    for i in range(1, int(x**0.5)+2):
        if x % i == 0:
            x_set.add(i)
            x_set.add(x//i)
    return x_set

def is_prime(x):
    for i in range(2, int(x**0.5)+1):
        if x % i == 0:
            return None
    ans.add(x)

A, B = map(int, input().split())

A_set = bunkai(A)
B_Set = bunkai(B)
kari = A_set & B_Set

ans = set()
for x in kari:
    is_prime(x)
print(len(ans))

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

int main(){
  int K,A,B;
  cin>>K>>A>>B;
  
  int num=0;
  string ans="NG";
  for(int i=0;i<1000;i++){
    num=i*K;
    
    if(A<=num && num<=B){
      ans="OK";
      break;
    }
  }
    cout<<ans<<endl;


}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  arr(b,n-1);
  b.push_back(1000000);

  vec a(n);
  rep(i,n){
    a[i]=0;
  }

  ll ans=0;
  rep(i,n){
    if(i==0){
      a[i]=b[i];
    } else {
      a[i]=min(b[i-1], b[i]);
    }
  }

  rep(i,n){
    ans+=a[i];
  }

  prt(ans);

}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    int N;
    cin >> N;
    printf("%lld\n", N * N * N);

    return 0;
}


Measured memory_bytes: 256
from collections import deque
Q=deque(list(input()))
rev=0

for _ in range(int(input())):
  query=input()
  if query[0]=='1':
    rev^=1
  else:
    q,f,c=query.split()
    if (f=='1')^(rev):
      Q.appendleft(c)
    else:
      Q.append(c)

if rev:
  Q=reversed(Q)
print(''.join(Q))

Measured memory_bytes: 74088
#include <cmath>
#include <vector>
#include <stdio.h>
#include <iostream>
using namespace std;

//-----------------------------------------
int triangle_area(int AB, int BC){
    int S;
    S = (AB*BC) / 2;
    return S;
}

int main() {
    // I/O format
    int AB, BC, CA; cin >> AB >> BC >> CA;
    int out;

    out = triangle_area(AB, BC);
    cout << out << endl;
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.chomp.split.map(&:to_i)

A = A.map.with_index { |elem, index| [index, elem]}
A = A.sort_by { |a| a[1] }.reverse

dpnxy = [[0,0]]
dpnxy1 = []
dpn = [0]
dpn1 = []

(1..N).each do |n|
  (0..(dpnxy.length-1)).each do |i|
    x = dpnxy[i][0]
    y = dpnxy[i][1]
    n_left = x
    n_right = N-1-y

    if A[n-1][0] >= n_left
      l = dpn[i] + A[n-1][1] * (A[n-1][0] - n_left)
      
      if i!=0 and dpnxy1[dpnxy1.length-1][0] == x+1 and dpnxy1[dpnxy1.length()-1][1] == y
        if dpn1[dpn1.length-1] < l
          dpn1[dpn1.length-1] = l
        end
      else
        dpnxy1 << [x+1,y]
        dpn1 << l
      end
    end

    if A[n-1][0] <= n_right
      r = dpn[i] + A[n-1][1] * (n_right - A[n-1][0])
      dpnxy1 << [x,y+1]
      dpn1 << r
    end
  end
  dpnxy = dpnxy1
  dpn = dpn1
  dpnxy1 = []
  dpn1 = []
end
p dpn.max

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

#define endl '\n'
#define rep(i,n)       for(int i=0; i<n; i++)
#define clr(arr)       memset(arr, 0, sizeof arr)
#define all(x)         x.begin(), x.end()
const int MOD = 1e9 + 7;

#ifdef SMIT
template<class F, class S> ostream& operator<<(ostream &out, const pair<F, S> &p)
{
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out)
{
	out << '{';
	for (auto i = x.begin(); i != x.end(); i++)
		out << *i << (i == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dmp() {}
template<class T, class... Args> void dmp(T &&x, Args... args)
{
	cerr << x << ";  "; dmp(args...);
}
struct Nl {~Nl() {cerr << '\n';}};
#define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dmp(x), Nl(), cerr << ""
#else
#define debug(...) {}
#endif
// Yes you CAN


int n;
void solve()
{
// #define TEST
	cin >> n;
	if (n >= 30)  cout << "Yes" << endl;
	else cout << "No" << endl;
}

int32_t main()
{
#ifdef SMIT
	// freopen("/home/smit/Desktop/in.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false); cin.tie(nullptr);

	int t = 1;
#ifdef TEST
	cin >> t;
#endif
	while (t--)
		solve();
}

Measured memory_bytes: 3648
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int n,a;
set<int>s;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        s.insert(a);
    }
    cout<<s.size()<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define state(a, b, c, d) (a * 7*7*7 + b * 7*7 + c * 7 + d)

using namespace std;

int N;
const int ST = state(6, 6, 6, 6) + 1;
int sche[370][16];
bool dp[370][ST][3][3];

int main(void)
{
	while(1){
		cin >> N;
		if(N == 0) break;
		
		for(int i = 1; i <= N; i++){
			for(int j = 0; j < 16; j++){
				cin >> sche[i][j];
			}
		}
		
		if(sche[1][5] || sche[1][6] || sche[1][9] || sche[1][10]){
			cout << "0" << endl;
			continue;
		}
		
		for(int i = 1; i <= N; i++){
			for(int j = 0; j < ST; j++){
				for(int x = 0; x < 3; x++){
					for(int y = 0; y < 3; y++){
						dp[i][j][x][y] = false;
					}
				}
			}
		}
		dp[1][state(1, 1, 1, 1)][1][1] = true;
		
		int pos;
		int st, sa, sb, sc, sd;
		
		for(int i = 1; i < N; i++){
			for(int j = 0; j < ST; j++){
				for(int x = 0; x < 3; x++){
					for(int y = 0; y < 3; y++){
						if(dp[i][j][x][y] == false) continue;
						for(int nx = 0; nx < 3; nx++){
							for(int ny = 0; ny < 3; ny++){
								if( abs(nx-x)+abs(ny-y) > 2 || (nx-x)*(ny-y)) continue;
								pos = ny*4 + nx;
								if(sche[i+1][pos] || sche[i+1][pos+1] || sche[i+1][pos+4] || sche[i+1][pos+5]) continue;
								st = j;
								sd = st % 7, st /= 7;
								sc = st % 7, st /= 7;
								sb = st % 7, st /= 7;
								sa = st % 7;
								sa++, sb++, sc++, sd++;
								if(pos == 0) sa = 0;
								if(pos == 2) sb = 0;
								if(pos == 8) sc = 0;
								if(pos == 10) sd = 0;
								if(sa > 6 || sb > 6 || sc > 6 || sd > 6) continue;
								dp[i+1][state(sa, sb, sc, sd)][nx][ny] = true;
								
							}
						}
					}
				}
			}
		}
		
		int flag = false;
		for(int i = 0; i < ST; i++){
			for(int x = 0; x < 3; x++){
				for(int y = 0; y < 3; y++){
					if(dp[N][i][x][y]){
						flag = true;
						goto end;
					}
				}
			}
		}
		end:;
		if(flag) cout << "1" << endl;
		else cout << "0" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 10728
#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef set<int> SI;
typedef map<string, int> MSI;
typedef map<int, int> MII;
typedef pair<ll, ll> PLL;
typedef pair<ll, pair<ll, ll>> PLLL;

#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
#define MOD 1000000007
#define test ll t;cin>>t;while(t--)

void solve()
{
	string s;
	cin >> s;
	ll sum=0;
	for(int i=0;i<s.size();i++)
	{
		sum+=(s[i]-'0');
	}
	if(sum%9)
		cout << "No\n";
	else cout << "Yes\n";
	return;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	flash;

	// test
	// {
	// 	solve();
	// }
	solve();
#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed : " << 1000 * (double)clock() / (double)CLOCKS_PER_SEC
	     << " ms\n";
#endif
	return 0;
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll dp[N],a[N],sum[N];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum[i]=(i>2?sum[i-2]:0)+a[i];
    }
    for(int i=2;i<=n;i++){
        if(i&1) dp[i]=max(dp[i-1],dp[i-2]+a[i]);
        else dp[i]=max(sum[i-1],dp[i-2]+a[i]);
    }
    cout<<dp[n];
}


Measured memory_bytes: 8272
//#define NDEBUG

#pragma region cp_template

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>

namespace n91 {

using i32 = std::int32_t;
using i64 = std::int64_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

struct rep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
struct revrep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) noexcept {
  return a < b ? b - a : a - b;
}
template <class T> void chmin(T &a, const T &b) noexcept {
  if (b < a)
    a = b;
}
template <class T> void chmax(T &a, const T &b) noexcept {
  if (a < b)
    a = b;
}
template <class F> class rec_lambda {
  F f;

public:
  rec_lambda(F &&f) : f(std::move(f)) {}
  template <class... Args> auto operator()(Args &&... args) const {
    return f(*this, std::forward<Args>(args)...);
  }
};
template <class F> auto make_rec(F &&f) { return rec_lambda<F>(std::move(f)); }
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}
constexpr char eoln = '\n';
template <class T> T ceildiv(const T &l, const T &r) {
  return l / r + (l % r != 0 ? 1 : 0);
}

} // namespace n91

#pragma endregion cp_template

namespace n91 {

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const u32 x = scan<u32>();
  u32 c = 0;
  usize k = 0;
  do {
    c = (c + x) % 360;
    k += 1;
  } while (c != 0);
  std::cout << k << eoln;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const ll mod = 1000000007;

ll n, k, a[200010];
vector<ll> vecp, vecm;
int cnt0;
ll ans = 1;

signed main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == 0)cnt0++;
		else if (0 < a[i])vecp.push_back(a[i]);
		else vecm.push_back(a[i]);
	}
	if (n < cnt0 + k) {
		cout << 0 << endl;
		return 0;
	}
	if (n == k) {
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if (0 <= a[i])ans = ans * a[i] % mod;
			else ans = ans * -a[i] % mod, cnt++;
		}
		if (cnt % 2)cout << (mod - ans) % mod << endl;
		else cout << ans << endl;
		return 0;
	}
	sort(all(vecp));
	sort(all(vecm));
	if ((int)vecp.size() == 0) {
		if (k % 2) {
			if (cnt0) {
				cout << 0 << endl;
				return 0;
			}
			reverse(all(vecm));
			for (int i = 0; i < k; i++)ans = ans * -vecm[i] % mod;
			cout << (mod - ans) % mod << endl;
		}
		else {
			for (int i = 0; i < k; i++)ans = ans * -vecm[i] % mod;
			cout << ans << endl;
		}
		return 0;
	}
	reverse(all(vecp));
	int j = 0, l = 0;
	int cnt = 0;
	for (int i = 0; i < k; i++) {
		if (j == (int)vecp.size()) {
			ans = ans * -vecm[l] % mod;
			l++; cnt++;
		}
		else if (l == (int)vecm.size()) {
			ans = ans * vecp[j] % mod;
			j++;
		}
		else if (vecp[j] < -vecm[l]) {
			ans = ans * -vecm[l] % mod;
			l++; cnt++;
		}
		else {
			ans = ans * vecp[j] % mod;
			j++;
		}
	}
	if (cnt % 2 == 0) {
		cout << ans << endl;
		return 0;
	}
	if (j == (int)vecp.size())cout << ans * mod_pow(vecp[j - 1], mod - 2, mod) % mod*-vecm[l] % mod << endl;
	else if (l == (int)vecm.size())cout << ans * mod_pow(-vecm[l - 1], mod - 2, mod) % mod*vecp[j] % mod << endl;
	else if (!j)cout << ans * mod_pow(-vecm[l - 1], mod - 2, mod) % mod*vecp[0] % mod << endl;
	else {
		ll p = vecm[l - 1] * vecm[l];
		ll q = vecp[j] * vecp[j - 1];
		if (p <= q)cout << ans * mod_pow(-vecm[l - 1], mod - 2, mod) % mod*vecp[j] % mod << endl;
		else cout << ans * mod_pow(vecp[j - 1], mod - 2, mod) % mod*-vecm[l] % mod << endl;
	}
}


Measured memory_bytes: 6620
while True:
    n,k,m=map(int,raw_input().split())
    if n==k==m==0:break
    L=range(1,n+1)
    del	L[m-1]
    i=(m-2+k)%len(L)
    while len(L)!=1:
	del L[i]
        i=(i+k-1)%len(L)
    print L[0]

Measured memory_bytes: 4592
import sys, math
from functools import lru_cache
from collections import defaultdict, Counter
import bisect
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    a, b = i2(3)
    c = a+b
    if c.count(1) == 3 or c.count(2) == 3 or c.count(3) == 3 or c.count(4) == 3:
        print('NO')
    else:
        print('YES')




if __name__ == '__main__':
    main()


Measured memory_bytes: 9564
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;
	vector<ll> a(m);
	REP(i,m) cin >> a[i];
	ll cnt = 0;
	REP(i,m) if(a[i] % 2) cnt++;

	if(n % 2) {
		if(cnt > 1) {
			cout << "Impossible" << endl;
			return 0;
		}
		if(m == 1 && a[0] == 1) {
			cout << 1 << endl;
			cout << 1 << endl;
			cout << 1 << endl;
			return 0;
		}
		if(m == 1) {
			cout << a[0] << endl;
			cout << 2 << endl;
			cout << a[0] - 1 << " " << 1 << endl;
			return 0;
		}
		ll buf = -1;
		vector<ll> ans1;
		vector<ll> ans2;
		REP(i,m) {
			if(a[i] % 2) buf = a[i];
			else ans1.pb(a[i]);
		}
		ans1.pb(buf);
		REP(i,m) {
			if(i == 0) {
				ans2.pb(ans1[i] - 1);
			} else if(i == m - 1) {
				ans2.pb(ans1[i] + 1);
			} else ans2.pb(ans1[i]);
		}
		DUMP(ans1);
		cout << (ll)ans2.size() << endl;
		DUMP(ans2);
		return 0;

	} else {
		if(cnt > 2) {
			cout << "Impossible" << endl;
			return 0;
		}
		if(cnt == 0) {
			vector<ll> ans1(m);
			REP(i,m) ans1[i] = a[i];
			vector<ll> ans2;
			ans2.pb(1);
			REP(i,m) {
				if(i != m - 1) ans2.pb(ans1[i]);
				else ans2.pb(ans1[i] - 1);
			}
			DUMP(ans1);
			cout << (ll)ans2.size() << endl;
			DUMP(ans2);
			return 0;
		}
		if(cnt == 2) {
			vector<ll> ans1;
			P buf = P(-1, -1);
			REP(i,m) {
				if(a[i] % 2) {
					if(buf.first == -1) buf.first = a[i];
					else buf.second = a[i];
				}
			}
			ans1.pb(buf.first);
			REP(i,m) if(a[i] % 2 == 0) ans1.pb(a[i]);
			ans1.pb(buf.second);
			vector<ll> ans2;
			REP(i,m) {
				if(i == 0) {
					ans2.pb(ans1[i] + 1);
				} else if(i == m - 1) {
					if(ans1[i] != 1) ans2.pb(ans1[i] - 1);
				} else {
					ans2.pb(ans1[i]);
				}
			}
			DUMP(ans1);
			cout << (ll)ans2.size() << endl;
			DUMP(ans2);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
 
#define fi first
#define se second
#define endl '\n'
#define MOD(n,k) (((n % k) + k ) % k)

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

    string s;

    cin >> s;

    if (s.size() >= 4 && s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}  

Measured memory_bytes: 256