akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




//10億7。　　　100000007
//2*2行列 H*W
//vector<vector<int>> vec(H,vector<int>(W));
//for(int i=0;i<H;i++){
//for(int j=0;j<W;j++){
//cin>>vec[i][j];
//  }
//}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);


int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  int sum=0;
  for(int i=1;i<N+1;i++){
    if(i<=K){
      sum+=X;}
    else{
      sum+=Y;
    }
  }
    cout<<sum<<endl;
  
  
  
}


Measured memory_bytes: 256
#include<stdio.h>
int a[105];
int main()
{
    int m;
    while(scanf("%d",&m)!=EOF)
    {
        int i,j,min,x,t=0;
        for(i=0; i<m; i++)scanf("%d",&a[i]);
        for(i=0;i<m;i++)
            for(j=m-1; j>=0; j--)
                if(a[j]<a[j-1])
                {
                    x=a[j-1];
                    a[j-1]=a[j];
                    a[j]=x;
                    t++;
                }
        for(i=0; i<m-1; i++)printf("%d ",a[i]);
        printf("%d\n%d\n",a[i],t);

    }
    return 0;
}


Measured memory_bytes: 2092
import math

MOD = 10**9 + 7


def main():
    N, K = map(int, input().split())
    R = int(math.sqrt(N))
    if N // R == R:
        M = R * 2 - 1
    else:
        M = R * 2
    mapping = [0] * (M+1)
    for i in range(1, R+1):
        mapping[i] = i
        mapping[-i] = N//i
    cnt = [0] * (M+1)
    for i in range(1, M+1):
        cnt[i] = mapping[i] - mapping[i-1]
    dp = [[0] * (M+1) for _ in range(K+1)]
    dp[0] = list(cnt)
    for i in range(M):
        dp[0][i+1] += dp[0][i]

    for i in range(K-1):
        for j in range(1, M+1):
            if j <= R:
                idx = -j
            else:
                idx = M - j + 1
            dp[i+1][j] = dp[i][idx]
        for j in range(M):
            dp[i+1][j+1] = (dp[i+1][j] + dp[i+1][j+1] * cnt[j+1]) % MOD
    print(dp[K-1][M])


if __name__ == "__main__":
    main()


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

int main() {
    int a, b, c, d;
    
    cin >> a >> b >> c >> d;
    
    if ( abs(a - c) <= d || (abs(a-b) <= d && abs(b-c) <= d) ) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    
    return (0);
}


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

typedef std::pair <int, int> pr;
const int N = 4054;

int n;
char A[N], B[N];
int l[N], r[N];
pr pts[N];

inline void down(int &x, const int y) {x > y ? x = y : 0;}
inline int min(const int x, const int y) {return x < y ? x : y;}

int solve() {
	int i, j, offset, cnt, ret = INT_MAX, cur;
	char *Bp = B;
	for (i = 1; i < 2 * n; ++i) l[i] = (B[i] & 1 ? 0 : l[i - 1] + 1);
	memcpy(l, l + n, n << 2);
	for (i = 2 * n - 1; i >= 0; --i) r[i] = (B[i] & 1 ? 0 : r[i + 1] + 1);
	for (offset = 0; offset < n; ++offset, ++Bp) {
		for (cnt = i = 0; i < n; ++i)
			if (A[i] != Bp[i]) pts[cnt++] = pr(l[i], r[i]);
		sort(pts, pts + cnt, std::greater <pr> ());
		j = offset, cur = INT_MAX;
		for (i = 0; i < cnt; ++i)
			if (pts[i].second > j)
				down(cur, pts[i].first + j), j = pts[i].second;
		down(cur, j), down(ret, cur * 2 - offset + cnt);
	}
	return ret;
}

int main() {
	int ans1, ans2;
	scanf("%s%s", A, B), n = strlen(A), memcpy(B + n, B, n);
	if (!std::count(B, B + n, '1')) return puts(std::count(A, A + n, '1') ? "-1" : "0"), 0;
	ans1 = solve(), std::reverse(A, A + n), std::reverse(B, B + 2 * n);
	ans2 = solve(), printf("%d\n", min(ans1, ans2));
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <math.h>
#include <vector>
#include <cstdlib>

using namespace std;

int main(int argc, const char * argv[]) {
	int A, B;
	int count = 1;
	int sum = 0;

	cin >> A;
	cin >> B;

	if(B == 1){
		cout << 0 << endl;
		return 0;
	}
	if(A >= B){
		cout << 1 << endl;
		return 0;
	}

	sum = A;
	while(1){
		sum += (A - 1);
		count++;
		if(sum >= B){ break;}
	}

	cout<< count << endl;

	return 0;
}


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

int main(void) {
  int A, B, K;
  cin >> A >> B >> K;
  for (int i = A; i <= min(A + K - 1, B); i++) {
    cout << i << endl;
  }
  for (int i = max(B - K + 1, A + K); i <= B; i++) {
    cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC044 A - 高橋くんとホテルイージー
// 2020.06.16

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K, X, Y; cin >> N >> K >> X >> Y;
  int ans = 0;
  if(N <= K){
    ans = X * N;
  }else{
    ans = X*K + Y*(N-K);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n,k;cin >> n >> k;
    int r,s,p;cin >> r >> s >> p;
    string t;cin >> t;
    int ans = 0;
    rep(i, t.size()) {
        if(i>=k) {
            if(t[i]==t[i-k]) {
                t[i]='z';
                continue;
            } 
        }
        if(t[i]=='r') ans+= p;
        else if(t[i]=='p') ans += s;
        else if(t[i]=='s') ans+=r;
    }
    cout << ans << endl;
}

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

int main()
{
    int x;
    cin>>x;
    bool* seive = new bool [100010];
    for(int i=0;i<100010;i++)
        seive[i] = true;

    for(int i=2;i<1000;i++)
    {
        if( seive[i] )
        {
            for(int j=2*i;j<100010;j = j+i)
            {
                seive[j] = false;
            }
        }
    }
    for(int i=x;i<100010;i++)
    {
        if( seive[i] )
        {
            cout<<i;
            break;
        }
    }

}


Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 != 0) {
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	cout << (a + b) / 2 << endl;
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,x,n) for(int i=(x);i<(n);i++)
#define sortn(a) sort((a).begin(),(a).end())
#define sortr(a) sort((a).begin(),(a).end(),greater<int>())
#define MOD 1000000007

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

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

    rep(i,s.size()){
        if(i%2 == 0){
            if(!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')){
                cout << "No" << endl;
                return 0;
            }

        }
    }

    cout << "Yes" << endl;
    
    return 0;
}



Measured memory_bytes: 256
N,K = map(int, input().split())

s = [0]*10**5
for _ in range(N):
    a,b = map(int, input().split())
    s[a-1] += b

sum_ = 0
for i in range(10**5):
    sum_ += s[i]
    if sum_ >= K:
        print(i+1)
        break


Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec; typedef pair<int, int> pi;
int dd[] = { 0, 1, 0, -1, 0 };
#define pb push_back
#define MAX 10000000
#define MAX_V 500

ivec G[MAX_V * 2];
int m, n;
int match[MAX_V * 2];
bool used[MAX_V * 2];

int gcd(int x, int y)
{
  if(x < y)swap(x, y);
  while(y > 0)
    {
      int r = x % y;
      x = y;
      y = r;
    }
  return x;
}
bool dfs(int v)
{
  used[v] = true;
  rep(i,G[v].size())
    {
      int u = G[v][i];
      int w = match[u];
      if(w < 0 || !used[w] && dfs(w))
	{
	  match[v] = u;
	  match[u] = v;
	  return true;
	}
    }
  return false;
}


int main()
{

  while(true)
    {
      scanf("%d%d", &m,&n);
      if(m==0&&n==0)break;
        int B[MAX_V], C[MAX_V];
      rep(i,m)scanf("%d",&B[i]);
      rep(i,n)scanf("%d",&C[i]);     
      rep(i,MAX_V*2)G[i].clear();
  rep(i,m)
    {
      rep(j,n)
	{
	  if(gcd(B[i],C[j])!=1)
	    {
	      G[i].pb(j+MAX_V);
	      G[j+MAX_V].pb(i);
	    }
	}
    }

  int res = 0;
  memset(match, -1, sizeof(match));
  rep(v, MAX_V*2)
    {
      if(match[v]<0)
	{
	  memset(used,0,sizeof(used));
	  if(dfs(v))
	    {
	      res++;
	    }
	     
	}
    }
       printf("%d\n", res);
    }
  return 0;
}

Measured memory_bytes: 5012
def main():
    from collections import Counter
    import sys
    input = sys.stdin.readline
    n=int(input())
    s=[]
    for _ in range(n):
        s.append(input().rstrip())
    c = Counter(s)
    ans=[]
    max_vote = max(c.values())
    for i,j in c.items():
        if j == max_vote:
            ans.append(i)
    print("\n".join(sorted(ans)))
main()

Measured memory_bytes: 35952
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;
int main()
{
 long long int n,a[200002];
 scanf("%lld",&n);
 for(int i=0;i<n;i++)
 {
	scanf("%lld",&a[i]);
 }
 sort(a,a+n,greater<long long int>());
 long long int ans=0;
 for(int i=1;i<n;i++)
 {
	ans+=a[(i/2)];
 }
 printf("%lld",ans);
}

Measured memory_bytes: 5404
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int n; cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  
  unordered_map<int,int> mape, mapo;
  
  rep(i, n/2) {
    mape[v[2*i]]++;
    mapo[v[2*i+1]]++;
  }

  
  vector<pair<int,int>> vpe(0), vpo(0);
  for(auto p : mape) vpe.push_back(make_pair(p.second,p.first));
  for(auto p : mapo) vpo.push_back(make_pair(p.second,p.first));
  
  sort(all(vpe)); reverse(all(vpe));
  sort(all(vpo)); reverse(all(vpo));
  
  if(vpe[0].second != vpo[0].second) cout << n-vpe[0].first-vpo[0].first << endl;
  else if(vpe[0].first+vpo[1].first >= vpo[0].first+vpe[1].first)
                          cout << n-(vpe[0].first+vpo[1].first) << endl;
  else cout << n-(vpe[1].first+vpo[0].first) << endl;
}


Measured memory_bytes: 7440
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;cin>>N;
  vector<int> X(N);
  for(int i=0; i<N; i++)cin>>X[i];
  int m=100000000;
  for(int p=1; p<=100; p++){
    int wa=0;
    for(int i=0; i<N; i++){
      wa+=(X[i]-p)*(X[i]-p);
    }
    m=min(m,wa);
  }
  cout<<m<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if (s == u) cout << a - 1 << " " << b << "\n";
    if (t == u) cout << a << " " << b - 1 << "\n";
    return 0;
}

Measured memory_bytes: 892
f = []
f = input().split()
if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
          else:
               print("NO")
     else:
          print("NO")
else:
     print("NO")

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

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

    int count = 0;
    int i = 1;
    while(true) {
        if(i * A > B) {
            break;
        }
        count++;
        i++;

        if(count >= C) {
            break;
        }
    }

    cout << count << endl;
}

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

const int maxn = 100 + 5;
const int maxm = 10000 + 5;

int v[maxn],w[maxn];
int f[maxm];

int main()
{
    int N,W;
    scanf("%d%d",&N,&W);
    for(int i = 1;i <= N; i++)scanf("%d%d",&v[i],&w[i]);
    for(int i = 1;i <= N; i++)
    {
        for(int j = W;j >= w[i]; j--)
        {
            f[j] = max(f[j],f[j-w[i]] + v[i]);
        }
    }
    printf("%d\n",f[W]);
}

Measured memory_bytes: 3240
#define _USE_MATH_DEFINES 
#include <cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#define rep(i,start,n) for(int i=start;i<n;i++)
#define And &&
#define Or ||
#define Lb cout<<endl
using namespace std;

int main(void) {
	string str;
	while (true) {
		getline(cin, str);
		int sum = 0;
		if (str == "0")break;
		rep(i, 0, str.length()) {
			sum +=str[i]-'0';
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 1180
def main():
    L, R, d = map(int, input().split())
    if d == 1:
        return R-L+1
    if L == 1:
        return R//d
    return R//d - (L-1)//d
print(main())
#if main():
#    print('Yes')
#else:
#    print('No')


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

int main(){
    double A,B,H,M;
    cin >> A >> B >> H >> M;

    double hang = 360.*(H+M/60.0)/12.;
    double mang = 360.*M/60.;

    double ang = min((abs(hang-mang)),(360-abs(hang-mang)));
	cout << fixed << setprecision(10);
    cout << sqrt(A*A+B*B-2*A*B*cos(ang*3.14159265358979/180.)) << endl;


}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int mod = 1e9 + 7;

template <class T> inline bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <class T> inline bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if(a[0] == a[1] && a[1] != a[2] || a[2] == a[1] && a[1] != a[0])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

using namespace std;

const int MAX_V = 101;
vector<int> adj[MAX_V];
bool used[MAX_V];
int id[MAX_V];

void bfs(int s){
  queue<int> que;
  que.push(s);
  used[s]=true;
  id[s]=0;
  for(;!que.empty();){
    int p=que.front();
    que.pop();
    for(int i:adj[p]){
      if(!used[i]){
	que.push(i);
	used[i]=true;
	id[i]=id[p]+1;
      }
    }
  }
}

int main(){
  fill(id,id+MAX_V,-1);
  int n;cin>>n;
  REP(i,n){
    int u,k,v;cin>>u>>k;
    REP(j,k){
      cin>>v;
      adj[u].push_back(v);
    }
  }
  bfs(1);
  REP(i,n) cout<<i+1<<" "<<id[i+1]<<endl;
}

Measured memory_bytes: 1224
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var N, all int
	fmt.Scan(&N)
	sc.Split(bufio.ScanWords)
	a := make([]int, N)
	m := map[int]int{}
	for i := 0; i < N; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		m[a[i]]++
	}
	for _, v := range m {
		all += v * (v - 1) / 2
	}
	for i := 0; i < N; i++ {
		ans := all
		ans -= m[a[i]] * (m[a[i]] - 1) / 2
		ans += (m[a[i]] - 1) * (m[a[i]] - 2) / 2
		fmt.Println(ans)
	}
}


Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

void find_divisor(ll N, vector<ll>& divisor) {
  for(int i=1; i<=sqrt(N); i++) {
    if(N % i == 0)
      divisor.push_back(i);
  }
  int n = divisor.size();
  for(int i=n-1; i>=0; i--) {
    if(N != (ll)pow(divisor[i], 2))
      divisor.push_back(N / divisor[i]);
  }
}
ll extGCD(ll a, ll b, ll &x, ll &y) {
  if(b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  ll d = extGCD(b, a%b, y, x);
  y -= a/b * x;
  return d;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n; cin >> n;
  vector<ll> div;
  find_divisor(n*2, div);
  ll ans = n*2-1;
  for(ll d1: div) {
    ll d2 = n*2/d1;
    if(__gcd(d1, d2) != 1) continue;
    ll x, y;
    extGCD(d1, d2, x, y);
    if(x == 0 || y <= 0) continue;
    chmin(ans, -d1*x);
  }
  cout << ans << endk;
  return 0;
}


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

#define ll long long

using namespace std;

ll n, a, b;
int main(){
    cin >> n >> a >> b;
    if(abs(a - b)%2 == 0) cout << abs(a - b)/2;
    else{
        ll r1 = min(a, b) + abs(a - b)/2;
        ll r2 = min(n - a, n - b) + 1 + abs(a - b)/2;
        cout << min(r1, r2);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define per(i,x,y) for (int i=(x); i>=(y); i--)
#define ll long long
#define ld long double
#define inf 1000000000
using namespace std;
#define N 3005
int n,mod,f[N],s[N][N],pw[N*N],fac[N],inv[N],ans;
int ksm(int x,int p,int mod){
	int ret=1;
	for (x%=mod; p; p>>=1,x=(ll)x*x%mod) if (p&1) ret=(ll)ret*x%mod;
	return ret;
}
int getinv(int x){ return ksm(x,mod-2,mod); }
int C(int n,int m){ return (ll)fac[n]*inv[m]%mod*inv[n-m]%mod; }
void pre(int n){
	pw[0]=1; rep (i,1,n*n) pw[i]=2ll*pw[i-1]%mod;
	fac[0]=1; rep (i,1,n) fac[i]=(ll)fac[i-1]*i%mod;
	inv[n]=getinv(fac[n]); per (i,n-1,0) inv[i]=(ll)inv[i+1]*(i+1)%mod;
}
int main(){
	scanf("%d%d",&n,&mod); pre(n);
	rep (i,0,n) s[i][0]=1;
	rep (i,1,n) rep (j,1,i) s[i][j]=(s[i-1][j-1]+(ll)(j+1)*s[i-1][j]%mod)%mod;
	rep (i,0,n){
		rep (j,0,i) f[i]=(f[i]+(ll)s[i][j]*pw[(n-i)*j]%mod)%mod;
		f[i]=(ll)f[i]*ksm(2,ksm(2,n-i,mod-1),mod)%mod;
	}
	rep (i,0,n) ans=(ans+mod+((i&1)?-1ll:1ll)*f[i]*C(n,i)%mod)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 70784
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <functional>

int main() {
  int N;
  std::string S;
  std::cin >> N >> S;

  std::size_t res = 0;
  for (int i = 1; i < N; ++i) {
    std::string x = S.substr(0, i);
    std::string y = S.substr(i, N - i);

    std::set<char> x_set(x.begin(), x.end());
    std::set<char> y_set(y.begin(), y.end());

    std::vector<char> intersection;
    std::set_intersection(x_set.begin(), x_set.end(),
			  y_set.begin(), y_set.end(),
			  std::inserter(intersection, intersection.end()));

    res = std::max(res, intersection.size());
  }
  std::cout << res << "\n";
  return 0;
}


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

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def gcd(a,b):
        if a == 0:
            return b
        return gcd(b%a,a)

    n = I()
    a = LI()
    g = a[0]
    l = a[0]
    for i in a[1:]:
        g = gcd(l,i)
        l = l*i//g
    ans = 0
    for i in a:
        ans += pow(i,mod-2,mod)
        ans %= mod
    print(ans*l%mod)
    return

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


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

int main(void) {
    bool get = false;
    int st;
    string s,t;
    cin >> s;
    cin >> t;
    for (int i=s.size()-t.size(); i >= 0; i--) {
        for (int j=0; j<t.size(); j++) {
            if (s[i+j] == t[j] || s[i+j] == '?') get = true;
            else {
                get = false;
                break;
            }
        }
        if (get) {
            st = i;
            break;
        }
    }
    if (!get) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    for (int i=0; i<t.size(); i++) s[st+i] = t[i];
    for (int i=0; i<s.size(); i++) {
        if (s[i] == '?') cout << 'a';
        else cout << s[i];
    }
    cout << endl;
    return 0;
}


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

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    h,w,k = LI()
    s = [input() for i in range(h)]
    ans = [[-1]*w for i in range(h)]
    k = 0
    l = []
    for y in range(h):
        for x in range(w):
            if s[y][x] == "#":
                k += 1
                l.append(y)
                break
        else:
            l.append(y)
            continue
        for x_ in range(x+1):
            for y_ in l:
                ans[y_][x_] = k
        for x_ in range(x+1,w):
            if s[y][x_] == "#":
                k += 1
            for y_ in l:
                ans[y_][x_] = k
        l = []
    if l:
        for x in range(w):
            for y in range(1,h):
                if ans[y][x] < 0:
                    ans[y][x] = ans[y-1][x]
    for i in ans:
        print(*i)
    return

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


Measured memory_bytes: 47196
import collections as c
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
N,M = ip()
a = set()
for i in range(M):
    a.add(int(input()))
dp = [0]*(N+1)
dp[0] = 1
if 1 in a:
    pass
else:
    dp[1] = dp[0]
if N>1:
    for i in range(2,N+1):
        if i in a:
            continue
        dp[i] += (dp[i-2] + dp[i-1])%mod
        dp[i] = int(dp[i] % mod)
print(dp[N])

Measured memory_bytes: 12268
S=input()
l=len(S)
ans=0
for bit in range(2**(l-1)):
  temp=S[0]
  for i in range(l-1):
    if bit>>i&1:
      temp+="+"+S[i+1]
    else:
      temp+=S[i+1]
  ans+=eval(temp)
print(ans)


Measured memory_bytes: 9008
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define INF 10000000000000000LL
#define ll  long long 
const int inf =INT_MAX;
const int MAX=3e5+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=1e6+9;
const int MAX_A=71;
const int LN=20;
using namespace std;

int countDivisors(int n) 
{ 
    int cnt = 0; 
    for (int i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            // If divisors are equal, 
            // count only one 
            if (n / i == i) 
                cnt++; 
            else // Otherwise count both 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
}

int main(){
    int N; cin >> N;
    int cnt, cnt8 = 0;
    if( N < 105){
        cout << 0 << "\n";
        return 0;   
    }
    for(int i = 107; i <= N; i += 2){
        cnt = countDivisors(i);
        if(cnt == 8)
            cnt8++;
    }
    cout << cnt8 + 1 << "\n";
    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int num=0;
    while(n != 1){
        n /= 2;
        num++;
    }
    int ans=1;
    for(int i=0; i<num; i++){
        ans *= 2;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;

int MOD=1000000007;


int main(){
    ll A,B,N,ans1,ans=0;
    cin >> A >> B >> N;
    if(N<B){
        ans1=A*N/B;
        ans=N/B;
        ans=A*ans;
        ans=ans1-ans;
    }else{
        ans1=A*(B-1)/B;
        ans=(B-1)/B;
        ans=A*ans;
        ans=ans1-ans;
    }
    cout << ans << endl;
}



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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const ll NN = 1e10 + 7;
const int N = 1e5 + 7;
const int M = 11;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;
const int B = sqrt(N);

void solve1()
{
    ll n;
    cin >> n;
    ll ans = 0;
    for( ll i = 1; i <= n; i++ ){
        if( i % 3 && i % 5 )ans += i;
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 3640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int n;
int64_t x[1'002], y[1'002], r[1'002];
double w[1'002][1'002];
double dist[1'002];

int main()
{
    int64_t sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    cin >> n;
    rep(i, n)
    {
        cin >> x[i] >> y[i] >> r[i];
    }
    x[n] = sx;
    y[n] = sy;
    r[n] = 0;
    x[n + 1] = tx;
    y[n + 1] = ty;
    r[n + 1] = 0;

    rep(i, n + 2) rep(j, n + 2)
    {
        int64_t dx = x[i] - x[j], dy = y[i] - y[j];
        w[i][j] = max(0.0, sqrt(dx * dx + dy * dy) - r[i] - r[j]);
    }

    using V = tuple<double, int>;
    priority_queue<V, vector<V>, greater<V>> q;

    q.push(make_tuple(0, n));
    fill(dist, dist + n + 2, 1e18);
    dist[n] = 0;

    while (!q.empty()) {
        int v;
        double d;
        tie(d, v) = q.top();
        q.pop();

        if (dist[v] < d) {
            continue;
        }

        rep(i, n + 2)
        {
            double nd = d + w[v][i];
            if (nd < dist[i]) {
                dist[i] = nd;
                q.push(make_tuple(nd, i));
            }
        }
    }
    cout << setprecision(12) << dist[n + 1] << endl;

    return 0;
}

Measured memory_bytes: 13808
#include <cstdio>
#include <algorithm>
#include <map>
#include <utility>

using i8 = std::int8_t;
using u8 = std::uint8_t;
using i16 = std::int16_t;
using u16 = std::uint16_t;
using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using usize = std::size_t;

using pair = std::pair<i64, i64>;

constexpr i64 MOD = 1000000007;

template<typename T, typename U>
constexpr auto pow_mod(T a, U b, const T m) -> T {
	T r = 1;
	while (b > 0) {
		if (b % 2 != 0) r = r * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return r;
}

auto main() -> i32 {
	i32 n;
	scanf("%d", &n);

	auto polar_cmp = [](const auto& a, const auto& b) {
		i128 ax = a.first;
		i128 ay = a.second;
		i128 bx = b.first;
		i128 by = b.second;
		return 0 < ax * by - ay * bx;
	};

	std::map<pair, i32, decltype(polar_cmp)> mp(polar_cmp);
	i64 zeros = 0;
	for (i32 i = 0; i < n; ++i) {
		i64 a, b;
		scanf("%ld%ld", &a, &b);
		if (b < 0) {
			a = -a;
			b = -b;
		}
		if (b == 0 && a < 0) {
			a = -a;
		}
		if (a != 0 || b != 0) {
			mp[pair(a, b)] += 1;
		} else {
			zeros += 1;
		}
	}

	i64 ans = 1;
	for (auto& [k, v] : mp) {
		auto tx = -k.second;
		auto ty = k.first;
		if (ty < 0) {
			tx = -tx;
			ty = -ty;
		}
		if (ty == 0 && tx < 0) {
			tx = -tx;
		}

		if (auto it = mp.find(pair(tx, ty)); it == mp.end()) {
			ans = ans * pow_mod((i64)2, v, MOD) % MOD;
		} else if (k.first > 0) {
			ans = ans * (pow_mod((i64)2, v, MOD) + pow_mod((i64)2, it->second, MOD) - 1) % MOD;
		}
	}
	ans = (ans + zeros + MOD - 1) % MOD;

	printf("%ld\n", ans);

	return 0;
}


Measured memory_bytes: 15684
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  string s;
  cin >>s;
  for(int i=0;i<s.size();i++){
    if(i==3) cout <<"8";
    else cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
  var n int
  fmt.Scan(&n)
  result := 0
  
  for c := 1; c <= n; c++ {
    num := 0
    if c % 2 == 1{
      for x := 1; x <= c; x++ {
        if c % x == 0 {
        	num = num + 1
        }
      }
      if num == 8 {
        result = result + 1
	  }
    }
  }
  fmt.Println(result)
}

Measured memory_bytes: 1768
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+100;
const int P = 1e9+7;
#define fr(i,a,b) for(int i = a;i <= b; ++i)
#define nfr(i,a,b) for(int i = a;i >= b; --i)
#define div div1234567891

int n,k;
int val[N];

inline int pow_mod(int x,int k){
   int res = 1,base = x;
   while(k){
      if(k&1)res = 1LL*res*base%P;
      k >>= 1; base = 1LL*base*base%P;
   }
   return res;
}

map<int,int> vis;
vector<int> div;

inline void add(int &x,int y){
   x += y; if(x >= P)x -= P;
}

int main(){
   scanf("%d%d",&n,&k);
   int w = (int)sqrt(n);
   fr(i,1,w){
      if(n%i == 0)div.push_back(i);
   }
   nfr(i,w,1){
      if(i*i != n && n%i == 0)div.push_back(n/i);
   }

   int ans = 0;
   int sz = div.size()-1;
   fr(i,0,sz){
      int cur = div[i];
      val[i] = pow_mod(k,(cur+1)/2);
      fr(j,0,i-1){
         if(div[i]%div[j] == 0)add(val[i],P-val[j]);
      }
      add(ans,1LL*val[i]*(cur%2 == 0 ? cur/2 : cur)%P);
   }
   printf("%d\n",ans);
   return 0;
}


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

int main(){
  char s[100];
  std::cin >> s;
  const int N = atoi(s);
  std::vector<int> numbers;
  for(int i = 0; i < N; i++) {
    std::cin >> s;
    numbers.push_back(atoi(s));
  }
  std::sort(numbers.rbegin(), numbers.rend());
  
  int sumA = 0;
  int sumB = 0;
  for(int i = 0; i < N; i++) {
    if(i % 2 == 0)
      sumA += numbers[i];
    else
      sumB += numbers[i];
  }
  std::cout<<sumA-sumB<<std::endl;
  return 0;
}


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

int n;
int v[5000];
int dp[5000][5000];    //dp[i][j] = {～, v[i], v[j]}, max-cnt

void chmax(int &a, int b) {
    a = max(a, b);
}

int main() {
    int i, j;
    
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v, v + n);
    
    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            dp[i][j] = 2;
        }
    }
    
    for (j = 1; j < n; j++) {
        for (i = 0; i < j; i++) {
            int d = v[j] - v[i];
            int val = v[j] + d;
            int index = lower_bound(v + j, v + n, val) - v;
            if (index < n && v[index] == val) {
                chmax(dp[j][index], dp[i][j] + 1);
            }
        }
    }
    
    int ans = 0;
    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            chmax(ans, dp[i][j]);
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 69888
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                if (i * 10000 + j * 5000 + (n - i - j) * 1000 == y) {
                    System.out.println(i + " " + j + " " + (n - i - j));
                    return;
                }

            }
        }
        System.out.println("-1" + " " + "-1" + " " + "-1");

    }
}

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

int main() {

    long long int a, b, c;
    cin >> a >> b >> c;

    a -= b;

    if ( a > c ) {
        cout << 0 << endl;
    } else {
        cout << c - a << endl;
    }

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  string S;
  cin >> S;
  int i=0;
  while(S[i]!='\0'){
	if(S[i]=='1')
	    S[i]='9';
	else
	    S[i]='1';
	i++;
    }
  cout << S <<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a > b  && a > c)  {
            calc(a,b,c);
        } else if (b > a && b > c) {
            calc(b, a, c);
        } else {
            calc(c, a, b);
        }
    }

    private static void calc(int a, int b, int c) {
        int half = a / 2;
        if (a % 2 == 1) half++;
        long big = (long)half *b *c;
        long small = (long)(a-half) *b *c;
        System.out.println(big-small);
    }
}


Measured memory_bytes: 35812
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#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 <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}

bool f(string s){
    rep(i,0,s.size()/2){
        if(s[i]!=s[s.size()-i-1])return false;
        
    }
    return 1;
}

signed main (){
    string s;cin>>s;
    if(s[0]!='A'){
        cout<<"WA"<<endl;
        return 0;
    }
    int cnt=0;
    rep(i,1,s.size()){
        if(2<=i&&i<=s.size()-2){
            if(s[i]=='C')cnt++;
            else if(isupper(s[i])){
                cout<<"WA"<<endl;
                return 0;
            }
        }else {
            if(isupper(s[i])){
                cout<<"WA"<<endl;
                return 0;
            }
        }
    }
    if(cnt==1)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;



}
/*
1-2
0.5-2

010
01110
00111
000000111
*/


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

using namespace std;


typedef long long ll;
typedef pair<ll,ll> P;


int main(){

  string s;

  cin>>s;
  string t="YAKI";
  int c=0;
  for(int i=0;i<min(4,(int)s.size());i++){
    if(s[i]==t[c])c++;
  }

  if(c==4)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    

  return 0;
}


Measured memory_bytes: 256
import Control.Monad

main = do
    n <- readLn :: IO Integer
    let seq753 = [1..] >>= (\r -> replicateM r [3, 5, 7])
    let fil753 = filter (\s -> all (\i -> elem i s) [3, 5, 7]) seq753
    let num753 = map (foldl (\a b -> 10 * a + b) 0) fil753
    print $ length $ takeWhile (<= n) num753

Measured memory_bytes: 2300
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}
int main(){
  int N;cin>>N;
  vi a(N+1);f(i,1,N+1)cin>>a[i];
  vi b(N+1);f(i,N/2+1,N+1)b[i]=a[i];
  for(int i= N/2;i>0;i--){
    for(int j=2; i*j<=N ;j++ ){
      b[i] +=b[j*i];
      
    }
    if(b[i]%2 ==a[i])b[i] =0;
    else if(b[i]%2 !=a[i])b[i]=1;
  }
  int m=0;
  rep(i,N+1){
    if(b[i]==1)m++;
  }
  cout<<m<<endl;
      rep(i,N+1){
        if(b[i]==1)cout<<i<<" ";
      }
    cout<<endl;

}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#pragma GCC optimization ("O3")
using namespace std;

#define ll              long long
#define ld              long double
#define pii             pair <int, int>
#define piii            pair <int, pii>
#define pll             pair <ll, ll>
#define plll            pair <ll, pll>

#define fa(i, n, N)     for (ll i = n; i <= N; i++)
#define fac(i, n, b, N) for (ll i = n; i <= N && b; i++)
#define fd(i, n, N)     for (ll i = n; i >= N; i--)

#define mp              make_pair
#define pb              push_back
#define pob             pop_back
#define pf              push_front
#define pof             pop_front
#define fi              first
#define se              second
#define pb              push_back

#define all(x)          x.begin(), x.end();
#define len             length()
#define endl            '\n'

#define db(x)           cerr << ">>>>>> " << #x << " -> " << x << endl

const ll inf = 1e9;
const ll MAX = 1e5+5;
const ll MOD = 1e9+7;
const double pi = acos(-1.0);
const double EPS = 1e-9;

void init (){
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}

int main() {
    init();

    int n;
    string s;

    cin >> n >> s;
    int temp = s.len;
    fa (i,0,temp-1){
      cout << char((s[i]-'A'+n)%26 + 'A');
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n-1);
  rep(i,n-1) cin >> b[i];
  a[0] = b[0];
  
  for(int i = 1; i <= n-2; i++){
    a[i] = min(b[i],b[i-1]);
  }
  a[n-1] = b[n-2];
  
  int ans = 0;
  rep(i,n) ans += a[i];
  
  cout << ans;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

using namespace std;

int main (void)
{
    int n, a, b, sum = 0;

    cin >> n >> a >> b;

    for (int i = 1; i <= n; i++) {
        int digit_sum = 0;
        int tmp = i;
        while (tmp != 0) {
            digit_sum += tmp % 10;
            tmp /= 10;
        }
        if (digit_sum >= a && digit_sum <= b) {
            sum += i;
        }
    }
    cout << sum << endl;

    return 0;
}

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

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back

int main() {
  ll N;
  cin >> N;
  vector<ll> h(N);

  ll m = 0;
  rep(i, N){
    cin >> h[i];
    if (m > h[i]) { // 左のますが大きかった時
      h[i]++; // 左を減らす
    }
    m = h[i];
  }
  // rep(i, N){
  //   cout << h[i] << endl;
  // }

  // YesなのにNoと出てしまうパターンがある
  bool flag = true;
  rep(i, N-1){
    if (h[i] > h[i+1]){
      flag = false;
      break;
    }
  }

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


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

long long x, y, a, b, c, p, m = 0, t = 0, u = 0, v = 0, s;
priority_queue<pair<long long, int>> Q;

int main()
{
	cin >> x >> y >> a >> b >> c;

	for (int i = 0; i < a; i++) {		
		cin >> p;
		Q.push(make_pair(p, 1));
	}

	for (int i = 0; i < b; i++) {
		cin >> p;
		Q.push(make_pair(p, 2));
	}

	for (int i = 0; i < c; i++) {
		cin >> p;
		Q.push(make_pair(p, 3));
	}

	while (t + u + v < x + y) {
		p = Q.top().first;
		s = Q.top().second;
		Q.pop();

		if (s == 1) {
			if (t < x) {
				t++;
				m += p;
			}
		}
		else if (s == 2) {
			if (u < y) {
				u++;
				m += p;
			}
		}
		else {
			v++;
			m += p;
		}
	}

	cout << m << endl;
}


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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int r;
    double pi = 3.141592653589793238;
    cin >> r; 
    cout.precision(10);

    cout << (double)r * 2 * 3.14159 << "\n";



}

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

int main() {
    using namespace std;
    unsigned long N, M;
    cin >> N >> M;
    vector<vector<unsigned long>> edge(N);
    for(unsigned long i = 0, A, B; i < M; ++i){
        cin >> A >> B;
        edge[--A].push_back(--B);
    }
    deque<unsigned long> ans, vis(N);
    auto dfs = [rec = [&edge, &ans, &vis](auto f, unsigned long now, unsigned long prev, unsigned long begin) -> bool{
        if(now != prev && now == begin)return true;
        if(vis[now])return false;
        vis[now] = 1;
        for(const auto& i : edge[now])if(i != prev)if(f(f, i, now, begin)){
            ans.push_back(now);
            return true;
        }
        return false;
    }](auto begin){return rec(rec, begin, begin, begin);};
    for(unsigned long i = 0; i < N; ++i){
        fill(vis.begin(), vis.end(), 0UL);
        if(dfs(i))break;
    }
    return 0 & puts(ans.empty() ? "-1" : "0");
}

Measured memory_bytes: 384