akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

using namespace std;

int main() {
    int N;
    cin >> N;
    
    vector<int> H(N);
    
    rep(i, N) cin >> H.at(i);
    
    bool res = true;
    
    rep(i, N) {
        if (i == 0) {
            continue;
        }
        
        if (H[i] < H[i - 1]) {
            res = false;
        }
        
        if (H[i-1] < H[i]) {
            H[i]--;
        }
    }
    
    cout << (res ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include<boost/multiprecision/cpp_int.hpp>
// namespace multiprecisioninteger = boost::multiprecision;
// using cint=multiprecisioninteger::cpp_int;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;++i)
#define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N,0)
#define brep1(i,N) bFor(i,N,1)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define eb emplace_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
#define matoutput(v) do{for(auto outimat:v)output(outimat);}while(0)
const ll mod=1000000007;
// const ll mod=998244353;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  if(n<r)return 0;
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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 gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
int main(){
  // startupcpp();
  // int codeforces;cin>>codeforces;while(codeforces--){
  ll i=1,j,f=0,N,M;
  cin>>N>>M;
  j=N;
  while(M--){
    print(i+f<<" "<<j);
    ++i;--j;
    if(!f&&N%2==0&&j-i<=N/2){
      f=1;
    }
  }
}

Measured memory_bytes: 3640
// Last Change: 06/13/2019 23:03:35.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

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

int GetDist(int h, int w, vector<string> &area, pair<int, int> a,
            pair<int, int> b) {

  vector<vector<int>> visited(h, vector<int>(w, 0));

  queue<pair<int, pair<int, int>>> q;
  q.push(make_pair(0, a));

  visited[a.first][a.second] = 1;

  while (!q.empty() and q.front().second != b) {
    int dist = q.front().first;
    pair<int, int> cur = q.front().second;
    for (int i = 0; i < 4; ++i) {
      int nextX = cur.first + dx[i];
      int nextY = cur.second + dy[i];

      if (nextX < 0 or nextX >= h or nextY < 0 or nextY > w) {
        continue;
      }

      if (visited[nextX][nextY] == 0) {
        visited[nextX][nextY] = 1;
        if (area[nextX][nextY] != 'x') {
          q.push(make_pair(dist + 1, make_pair(nextX, nextY)));
        }
      }
    }
    q.pop();
  }

  if (q.front().second == b) {
    return q.front().first;
  } else {
    return -1;
  }
}

ll Solve(const int h, const int w) {
  vector<pair<int, int>> yogore;
  pair<int, int> start;

  vector<string> area(h);
  for (auto &&e : area) {
    cin >> e;
  }

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (area[i][j] == '*') {
        yogore.push_back(make_pair(i, j));
      } else if (area[i][j] == 'o') {
        start = make_pair(i, j);
      }
    }
  }
  int yogoSize = yogore.size();

  vector<int> fromStart(yogoSize);
  vector<vector<int>> eachDist(yogoSize, vector<int>(yogoSize));

  for (int i = 0; i < yogoSize; ++i) {
    int dist = GetDist(h, w, area, start, yogore[i]);

    if (dist < 0) {
      return -1;
    }

    fromStart[i] = dist;
  }

  for (int i = 0; i < yogoSize; ++i) {
    for (int j = i; j < yogoSize; ++j) {
      if (i != j) {
        int dist = GetDist(h, w, area, yogore[i], yogore[j]);
        eachDist[i][j] = dist;
        eachDist[j][i] = dist;
      }
    }
  }

  vector<int> arr(yogoSize);
  iota(arr.begin(), arr.end(), 0);

  ll ans = numeric_limits<ll>::max();
  do {
    ll tmpAns = fromStart[arr[0]];
    for (int i = 1; i < yogoSize; ++i) {
      tmpAns += eachDist[arr[i - 1]][arr[i]];
    }
    ans = min(ans, tmpAns);
  } while (next_permutation(arr.begin(), arr.end()));

  return ans;
}

int main() {
  int w, h;

  while (cin >> w >> h and w > 0 and h > 0) {
    cout << Solve(h, w) << endl;
  }
}




Measured memory_bytes: 3028
#include <iostream>
#include<string>
#include<cmath>
#include<stack>
#include<map>
using namespace std;

#define NUM 1000001

int main()
{

//素数チェックに用いるーーーーーーーーー
int* table = new int[NUM];
int limit;

for(int i=0; i < NUM;i++)table[i] = 1;
table[0]=0;
table[1]=0;
limit = sqrt(NUM);


//cout<<"limit"<<limit<<endl;
 for(int i=2;i<=limit;i++){
        if(table[i] == 1){
            for(int k=2*i;k < NUM; k += i){
                table[k] = 0;
            }
        }
    }


//ーーーーーーーーーーーーーーーーーーーーーーーーーーーー



    int a,d,n;
    int anser;

    while(1){
  

    cin>>a>>d>>n;
    anser=0;
    if(a==0 and d==0 and n==0){break;}
    for(int i=1; i<= 1000000; i++){
            if(table[a+(i-1)*d] == 1)anser++;
            if(anser == n){
                cout<<a+(i-1)*d<<endl;
                break;
            }
        }
 



    }


    return 0;
}



Measured memory_bytes: 7000
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============

bool comp(const string& s, int l, int r) {
    const int N = s.size() / 2;
    rep(i, N) {
        if (s[l] != s[r]) {
            return s[l] > s[r];
        }
        l++; r++;
    }
    return false;
}

int find_dict_min(const string& u) {
    const int N = u.size() / 2;
    assert(N * 2 == u.size());
    int res = 0;
    REP(i, 1, N + 1) {
        if (comp(u, res, i)) {
            res = i;
        }
    }
    return res;
}

string make_u(string s) {
    auto t = s;
    reverse(t.begin(), t.end());
    auto u = s + t;
    return u;
}

bool notsame(string s) {
    set<char> st;
    for (char c : s)st.insert(c);
    return st.size() > 1;
}

int main()
{
    int N, K;
    string s;
    cin >> N >> K >> s;

    while (K > 1 && notsame(s)) {
        auto u = make_u(s);
        reverse(u.begin(), u.end());
        auto start = find_dict_min(u);
        s = u.substr(start, N);
        reverse(s.begin(), s.end());
        K--;
    }

    auto u = make_u(s);
    auto start = find_dict_min(u);
    auto res = u.substr(start, N);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int long long
#define endl "\n"
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr(a,b,c) for(int a=b; a<c; a++)
#define frr(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define R(a) ll a; cin >> a;
#define RS(a) string  a; cin >> a;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

#define RA(a, n) ll a[(n) + 1] = {}; fr(i, 1, (n)+1) {cin >> a[i];}
#define RM(a, n, m) int a[n + 1][m + 1] = {}; fr(i, 1, n+1) {fr(j, 1, m+1) cin >> a[i][j];}
#define reset(X) memset(X, 0, sizeof(X))
using vi=vector<int>;
const int inf = 1e18;
const int mod=1e9+7;
unsigned int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
bool isPrime(int n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
const int maxn=2e3+1;
int f[maxn];
int nCr(int n,int r)
{
    int ans=f[n];
    ans=(ans*modInverse(f[r],mod))%mod;
    ans=(ans*modInverse(f[n-r],mod))%mod;
    return ans;
}
signed main()
{
    fastio;
    R(n);
    n=(n^1);
    cout<<n<<endl;

}


Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cmath>
#include <complex>
using namespace std;
typedef complex<double> P;
int main(){
	int n;
	while(cin >> n && n){
		P p[100];
		double v[100];
		for(int i = 0 ; i < n ; i++)
			cin >> p[i].real() >> p[i].imag() >> v[i];
		
		P r(0,0);
		double w = 1.0;
		while(w > 1e-8){
			double dist = -1;
			P to;
			for(int i = 0 ; i < n ; i++){
				if( abs(r-p[i])/v[i] > dist ){
					dist = abs(r-p[i])/v[i];
					to = p[i];
				}
			}
			r += (to-r) * w;
			w = w * 0.9991;
		}
		double dist = 0;
		for(int i = 0 ; i < n ; i++){
			dist = max(dist,abs(r-p[i])/v[i]);
		}
		printf("%.10lf\n",dist);
	}
}

Measured memory_bytes: 1268
#include <iostream>
#include <vector>
using namespace std;
int main(void){
   vector<vector<int>> b(3,vector<int>(3));
   vector<vector<bool>> flag(3,vector<bool>(3,false));
   int n;
   for(int i = 0;i < 3;i++){
       for(int j = 0;j < 3;j++){
           cin >> b[i][j];
       }
   }
   cin >> n;
   vector<int> a(n);
   for(int i = 0;i < n;i++){
       cin >> a[i];
       for(int j = 0;j < 3;j++){
           for(int k = 0;k < 3;k++){
               if(a[i] == b[j][k])flag[j][k] = true;
           }
       }
   }
   bool ans = false;
   for(int i = 0;i < 3;i++){
       if(flag[0][i] && flag[1][i] && flag[2][i]){
           ans = true;
       }
       if(flag[i][0] && flag[i][1] && flag[i][2]){
           ans = true;
       }
   }
   if(flag[0][0] && flag[1][1] && flag[2][2]){
       ans = true;
   }
   
   if(flag[2][0] && flag[1][1] && flag[0][2]){
       ans = true;
   }
   
   cout << ((ans) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 all(a) (a).begin(),(a).end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define ub(s,x) upper_bound(all(s),x)-s.begin()
#define uniq(a) a.erase(unique(all(a)),a.end())
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


int main(void){
    int n, m;
    cin>>n>>m;
    vector<int> p(m),y(m),x(m);
    using P = pair<int,int>; // y,i
    map<int,vector<P>> vp;
    rep(i,m){
        cin>>p[i]>>y[i];
        vp[p[i]].push_back({y[i],i});
    }
    for(auto &itr : vp){
        auto &vec = itr.second;
        sort(all(vec));
        int k = vec.size();
        rep(i,k){
            x[vec[i].second] = i+1;
        }
    }
    rep(i,m){
        printf("%06d%06d\n", p[i], x[i]);
    }


    return 0;
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans=0;

    if(a<=c&&b<=d&&c<b){
        ans=b-c;
    }else if(c<=a&&b<=d&&a<b){
        ans=b-a;
    }else if(c<=a&&d<=b&&a<d){
        ans=d-a;
    }else if(a>d||c>b){
        ans=0;
    }else if(a<c&&d<b){
        ans=d-c;
    }

    cout << ans <<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	char c;

	for(int i=0;i<str.length();i++){
	    c=str.charAt(i);
	    if(Character.isUpperCase(c))System.out.print(Character.toLowerCase(c));
	    else System.out.print(Character.toUpperCase(c));
	}
	System.out.println();
    }
}
							   
	



Measured memory_bytes: 26924
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define minn fsbfdsjfbi
#define min fsdsjbi
ll a[100005];
ll m,n;
ll min(ll a,ll b)
{
	return a>b?b:a;
}
int find(int x)
{
	int l=1,r=m,mid;
	while(l<r)
	{
		mid=(l+r+1)/2;
		if(a[mid]>x)
		{
			r=mid;
		}
		else
		{
			l=mid+1;
		}
//		cout<<l<<endl;
	}
	return r;
}
int main()
{
	cin>>m>>n;
	
	for(int i=1;i<=m;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]==0)
		{
			i--;
			m--;
			n--;
		}
//		if(a[i]>0&&a[i-1]<=0)
	}
	if(n==0)
	{
		cout<<"0\n";
		return 0;
	}
	ll mid;
	for(int i=1;i<=m;i++)
	{
		if(a[i]>0)
		{
			mid=i;
			break;
		}
		if(i==m)
		{
			mid=i+1;
		}
	}
//	cout<<"ZHI\n";
	ll minn=0x7fffffffff;
//	int mid=find(0);
//	cout<<mid<<endl;
	for(int i=1;i<=m;i++)
	{
		if(mid-i>n)
		{
			continue;
		}
		if(mid-i==n)
		{
			minn=min(minn,abs(a[i]));
			continue;
		}
		if(mid-i>0&&mid-i<n)
		{
			if(i+n-1>m)
			{
				continue;
			}
			ll tmp=abs(a[i])+abs(a[i+n-1]-a[i]);
//			cout<<tmp<<endl;
			minn=min(minn,tmp);
			continue;
		}
		if(i-mid+1<n)
		{
			if(i-n+1<1)
			{
				continue;
			}
			ll tmp=abs(a[i])+abs(a[i]-a[i-n+1]);
//			cout<<i-n+1<<" "<<tmp<<endl;
			minn=min(minn,tmp);
			continue;
		}
		if(i-mid+1>n)
		{
			continue;
		}
		minn=min(minn,abs(a[i]));
	}
	cout<<minn<<endl;
	return 0;
}


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

using ll = long long;
using pll = pair<ll, ll>;

constexpr ll INF = 1e18;

int main() {
    int N, M, K, S;
    ll P, Q;
    cin >> N >> M >> K >> S;
    cin >> P >> Q;

    vector<ll> zd(N, INF);
    queue<int> que1;
    for(int i=0; i<K; ++i) {
        int c;
        cin >> c;
        c--;
        que1.push(c);
        zd[c] = 0;
    }

    vector<vector<int>> g(N);
    for(int i=0; i<M; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    while(!que1.empty()) {
        int v = que1.front();
        que1.pop();
        for(auto to : g[v]) {
            if(zd[to] == INF) {
                zd[to] = zd[v] + 1;
                que1.push(to);
            }
        }
    }

    vector<ll> d(N, INF);
    d[0] = 0;
    priority_queue<pll, vector<pll>, greater<pll>> que;
    que.push(make_pair(0, 0));
    while(!que.empty()) {
        pll p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first) {
            continue;
        }
        for(auto to : g[v]) {
            if(zd[to] == 0) {
                continue;
            }
            ll cost = to == N-1 ? 0 : (zd[to] > S ? P : Q);
            if(d[to] > d[v] + cost) {
                d[to] = d[v] + cost;
                que.push(make_pair(d[to], to));
            }
        }
    }
    cout << d[N-1] << endl;
}


Measured memory_bytes: 10940
def sugar_water(A: int, B: int, C: int, D: int, E: int, F: int)->tuple:
    max_dens = 0
    min_a, min_b, min_c, min_d = 0, 0, 0, 0
    for a in range(F//(100*A) + 1):
        for b in range((F-100*A*a)//(100*B) + 1):
            for c in range((F-100*A*a-100*B*b)//C + 1):
                for d in range((F-100*A*a-100*B*b-c*C)//D + 1):
                    if F < 100*A*a + 100*B*b + c + d:
                        continue
                    if E * (100*a*A + 100*b*B) < (c*C + d*D) * 100:
                        continue
                    if a == 0 and b == 0 and c == 0 and d == 0:
                        continue

                    dens = (c*C + d*D) / (100*a*A + 100*b*B + c*C + d*D)

                    if max_dens < dens:
                        min_a, min_b, min_c, min_d = a, b, c, d
                        max_dens = dens
    if min_a == 0 and min_b == 0 and min_c == 0 and min_d == 0:
        min_a = 1
    return 100*A*min_a + 100*B*min_b + C*min_c + D*min_d, C*min_c + D*min_d


if __name__ == "__main__":
    A, B, C, D, E, F = map(int, input().split())
    w, s = sugar_water(A, B, C, D, E, F)
    print(w, s)


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

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

int N,M,X;
int A,B;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M>>X;
	FOR(i,M) {
		cin>>x;
		if(x<X) A++;
		else B++;
	}
	cout<<min(A,B)<<endl;
	
}


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


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

using namespace std;

int hoge(vector<int> vec) {
	int ret = 100;
	int pre = 0;
	for (int i = 0; i <= 24; ++i) {
		if (i == 24 && pre == 0) { continue; }
		if (vec[i] > 1) {
			ret = 0;
			break;
		}
		if (i > 0 && vec[i] == 1) {
			ret = min(ret, i - pre);
			pre = i;
		}
	}
	return ret;
}

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

	if (N > 23) {
		cout << 0 << endl;
		return 0;
	}

	int ans = 0;
	for (int i = 0; i < (1<<N); ++i) {
		vector<int> vec(25, 0);
		vec[0] = vec[24] = 1;
		for (int j = 0; j < N; ++j) {
			if ((i>>j) & 1) { ++vec[D[j] % 24]; }
			else { ++vec[(24 - D[j]) % 24]; }
		}
		ans = max(ans, hoge(vec));
	}
	cout << ans << endl;

	return 0;
}


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

inline long long gcd(long long a, long long b) {
    long long r;
    while(b > 0) {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

int main() {
    FILE * fi, * fout;
    int i, n;
    long long  x;
    //fi = fopen("A.in" ,"r");
    //fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%d" ,&n);
    long long ans;
    fscanf(fi,"%lld" ,&ans);
    for(i = 1; i < n; i++) {
         fscanf(fi,"%lld" ,&x);
         ans = (ans / gcd(ans, x)) * x;
    }
    fprintf(fout,"%lld" ,ans);
    //fclose(fi);
    //fclose(fout);
    return 0;
}


Measured memory_bytes: 256
package main

/*
整数 N, Mが与えられます。

a1+a2+...+aN = Mとなる正整数からなる長さNの数列において、
a1,a2,...,aNの最大公約数のとり得る最大値を求めてください。

1 <= N <= 1e+05
N <= M <= 1e+09
a1,...,aNの最大公約数は、必ずMの約数
a1,...,aNをその約数で割れば、全てで疎な数列になる
Mの約数を大きいほうから確認していけばいい
*/
import (
	"fmt"
	"math"
	"os"
	"sort"
)

func main() {
	var N, M int
	fmt.Scan(&N)
	fmt.Scan(&M)

	ans := solve(N, M)
	if ans >= 0 {
		fmt.Printf("%d\n", ans)
	}
}

func solve(n, m int) int {
	dividers := allDivider(m)
	debug("dividers => %v\n", dividers)
	//大きい順に並べる
	sort.Sort(sort.Reverse(sort.IntSlice(dividers)))

	for _, d := range dividers {
		r := m / d
		if r >= n {
			return d
		}
	}
	return -1
}

/**
 * nで与えられた数字の全約数
 */
func allDivider(n int) []int {
	ret := make([]int, 0)
	ret = append(ret, 1)
	ret = append(ret, n)

	sqrt := int(math.Ceil(math.Sqrt(float64(n))))
	for d := 2; d <= sqrt; d++ {
		if n%d == 0 {
			ret = append(ret, d)
			ret = append(ret, n/d)
		}
	}
	return ret
}

const DEBUG_ENABLE = false

func debug(format string, a ...interface{}) (n int, err error) {
	if DEBUG_ENABLE {
		return fmt.Fprintf(os.Stdout, format, a...)
	} else {
		return 0, nil
	}
}


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

int main(void){
  int n, m, l;
  long long int a[200][200], b[200][200], c[200][200];

  // ?????????
  for (int i = 0; i < 200; i++) {
    for (int j = 0; j < 200; j++) {
      c[i][j] = 0;
    }
  }

  // ?????????????????????????????????
  cin >> n >> m >> l;

  // ??????A???????????????
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  
  // ??????B???????????????
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < l; j++) {
      cin >> b[i][j];
    }
  }

  // ??????C????¨??????????
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      for (int k = 0; k < m; k++) {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }

  // ??????(?¨?????????¨??????????????¨?????????OK)
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      cout << c[i][j];
      if(j != l -1){ cout << " "; }
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public final class Main {

    public static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        final int[] arr = fs.readArray(n);
        final int max = (int) 1e6;
        final boolean[] seen = new boolean[max + 1];
        boolean pairwiseCoprime = true;
        outer:
        for (int num : arr) {
            final int limit = num;
            for (int p = 2; p * p <= limit; p++) {
                if (num % p == 0) {
                    if (seen[p]) {
                        pairwiseCoprime = false;
                        break outer;
                    }
                    seen[p] = true;
                    while (num % p == 0) {
                        num /= p;
                    }
                }
            }
            if (num > 1) {
                if (seen[num]) {
                    pairwiseCoprime = false;
                    break;
                }
                seen[num] = true;
            }
        }
        if (pairwiseCoprime) {
            System.out.println("pairwise coprime");
            return;
        }
        int gcd = arr[0];
        for (int num : arr) {
            gcd = gcd(gcd, num);
        }
        System.out.println(gcd == 1 ? "setwise coprime" : "not coprime");
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


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

int main(){
  string s, maxLenS, maxCntS;
  int maxLen = 0, maxCnt = 0;
  map<string,int> cnt;

  while(cin >> s){
    if(s.size() > maxLen){
      maxLen = s.size();
      maxLenS = s;
    }

    cnt[s]++;

    if(cnt[s] > maxCnt){
      maxCnt = cnt[s];
      maxCntS = s;
    }
  }

  cout << maxCntS << " " << maxLenS << endl;
}

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


int main(){

    int A;
    int B;
    int C;

    cin >> A;
    cin >> B;
    cin >> C;

    if(B/A > C){
        cout << C;
    }else{
        cout << B/A;
    }

    

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  string as,bs,cs,count,ans;
  int a = 0,b = 0,c = 0;
  bool ok = true;
  cin >> as >> bs >> cs;
  count = as[a];
  a += 1;

  while(ok){
    if(count == "a"){
      count = as[a];
      a += 1;
      //cout << "a" << endl;
    }else if(count == "b"){
      count = bs[b];
      b += 1;
      //cout << "b" << endl;
    }else if(count == "c"){
      count = cs[c];
      c += 1;
      //cout << "c" << endl;
    }

    if(a == as.size()+1){
      ans += 'A';
      ok = false;
    }else if(b == bs.size()+1){
      ans += 'B';
      ok = false;
    }else if(c == cs.size()+1){
      ans += 'C';
      ok = false;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=998244353;
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

ll inv(ll n){
	if(n==1) return 1;
	return (MOD-MOD/n)*inv(MOD%n)%MOD;
}

ll c[maxn];



int main()
{
	//IOS;
	ll n,a,b,k;
	cin>>n>>a>>b>>k;

	c[0]=1;
	for(int i=1;i<=n;i++){
		c[i]=c[i-1]*inv(i)%MOD*(n-i+1)%MOD;
	}
	ll ans=0;
	REP(i,n+1){
		ll tmp=k-a*i;
		if(tmp%b)continue;
		ll meow=tmp/b;

		if(meow<0||meow>n) continue;

		ans+=c[i]*c[meow]%MOD;
		ans%=MOD;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 2560
N,K=(int(i) for i in input().split())
countG=0
count=0
if K%2==0:
    for i in range(1,N+1):
        if i%K==0:
            count+=1
        elif i%K==K/2:
            countG+=1
else:
    for i in range(1,N+1):
        if i%K==0:
            count+=1
print(count*count*count+countG*countG*countG)

Measured memory_bytes: 3060
from functools import lru_cache
N = int(input())
A = list(map(int, input().split()))

INF = 1.0e+100


dp = [[[None, INF] for _ in range(N+1)] for _ in range(N+1)]
for i in range(N):
    dp[i][i+1] = [A[i], 0]

for g in range(2, N+1):
    for l in range(N-g+1):
        r = l + g
        for i in range(l+1, r):
            lv, lc = dp[l][i]
            rv, rc = dp[i][r]
            nc = lv + rv + lc + rc
            if dp[l][r][1] > nc:
                dp[l][r][0] = lv + rv
                dp[l][r][1] = nc

print(dp[0][N][1])


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

vector<int> Normalize(const vector<int>& xs) {
  vector<deque<int>> rs;
  deque<int> q(xs.begin(), xs.end());
  rs.push_back(q);
  for (int i = 0; i < 3; i++) {
    q.push_back(q.front());
    q.pop_front();
    rs.push_back(q);
  }
  sort(rs.begin(), rs.end());
  return vector<int>(rs[0].begin(), rs[0].end());
}

int64 Encode(const vector<int>& xs) {
  int64 r = 0;
  for (int i = 0; i < 4; i++) {
    r *= 2000;
    r += xs[i];
  }
  return r;
}

int Symmetry(const vector<int>& xs) {
  if (xs[0] == xs[1] && xs[1] == xs[2] && xs[2] == xs[3]) return 4;
  if (xs[0] == xs[2] && xs[1] == xs[3]) return 2;
  return 1;
}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  s << "[";
  for (int i = 0; i < len; i++) {
    if (i > 0) s << ", ";
    s << v[i];
  }
  s << "]";
  return s;
}

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

  int n;
  cin >> n;
  vector<vector<int>> faces;
  for (int i = 0; i < n; i++) {
    vector<int> cs(4);
    for (int j = 0; j < 4; j++) {
      cin >> cs[j];
    }
    faces.push_back(Normalize(cs));
  }
  vector<int64> encoded_faces(n);
  for (int i = 0; i < n; i++) {
    encoded_faces[i] = Encode(faces[i]);
  }

  unordered_map<int64, int> f_count_map;
  for (int i = 0; i < n; i++) {
    f_count_map[encoded_faces[i]]++;
  }
  unordered_map<int64, int> symmetry_map;
  for (int i = 0; i < n; i++) {
    symmetry_map[encoded_faces[i]] = Symmetry(faces[i]);
  }

  int64 ans = 0;
  for (int f1 = 0; f1 < n; f1++) {
    f_count_map[encoded_faces[f1]]--;
    for (int f2 = f1 + 1; f2 < n; f2++) {
      f_count_map[encoded_faces[f2]]--;

      for (int d2 = 0; d2 < 4; d2++) {
        vector<int> vs(8);
        for (int i = 0; i < 4; i++) vs[i] = faces[f1][i];
        for (int i = 0; i < 4; i++) vs[7 - i] = faces[f2][(d2 + i) % 4];
        // cout << vs << endl;

        unordered_map<int64, int> r_count;
        r_count[Encode(Normalize({vs[4], vs[5], vs[1], vs[0]}))]++;
        r_count[Encode(Normalize({vs[5], vs[6], vs[2], vs[1]}))]++;
        r_count[Encode(Normalize({vs[6], vs[7], vs[3], vs[2]}))]++;
        r_count[Encode(Normalize({vs[7], vs[4], vs[0], vs[3]}))]++;

        int64 inc = 1;
        for (const auto& kv : r_count) {
          int r = kv.second;
          int s = f_count_map[kv.first];
          if (r > s) {
            inc *= 0;
            continue;
          }
          for (int k = 0; k < r; k++) {
            inc *= (s - k);
            inc *= symmetry_map[kv.first];
          }
        }
        ans += inc;
      }

      f_count_map[encoded_faces[f2]]++;
    }
  }

  cout << ans << endl;
}

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

int main(){
  int a,s,d;
  cin >> a>>s>>d;
  if(a==s && a!=d&&s!=d) cout <<"Yes"<<endl;
  else if(a==d && a!=s&&s!=d) cout <<"Yes"<<endl;
  else if(d==s && a!=d&&s!=a) cout <<"Yes"<<endl;
  else{
    cout <<"No"<<endl;
  }
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
using Graph=vector<vector<int>>;
typedef long long ll;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main(){
    int s,w;cin>>s>>w;
    if(w>=s) cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}

Measured memory_bytes: 3636
#pragma GCC optimize(2)
#include<iostream>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <cstring>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <sstream>
#include <map>
#include <unordered_map>
#include <vector> 
#include <bitset>
#include <cctype>
#include <set>
#include <stack>
#include <queue>
#include <fstream>
#include <numeric>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAXN = 200005;
const int MAXM = 20500;
const ll MOD = 1e9+7;

#define MP make_pair
#define INF 0x3f3f3f3f
#define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template <typename T> inline T min(T a, T b, T c,T d) { return min(min(a, b), min(c,d)); }
template <typename T, typename T1> inline T qpower(T x, T p, T1 mod) { T re = 1; x %= mod; while (p) { if (p & 1)re = (re * x) % mod; x = (x * x) % mod; p >>= 1; }return re; }
#define mst(X,Y) memset(X,Y,sizeof(X)) 
#define rep(i, a, n) for (int i=(a); i<=(n); i++)
#define per(i, a, n) for (int i=(a); i>=(n); i--)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) { cerr << " " << to_string(H);    debug_out(T...);}


int fa[MAXN];
int tj[MAXN];
void init(int n)
{
    for (int i=1;i<=n;i++)
        fa[i]=i;
}
int tfind(int x)
{
    if (x==fa[x])   return x;
    else return fa[x]=tfind(fa[x]);   //路径压缩
}
void tunion(int a,int b)
{
    fa[tfind(b)]=tfind(a);
}
int maxCount(int n)
{
    for (int i=1;i<=n;i++)
	{
        tj[tfind(i)]++;
	}
	int mx = 0;
	rep (i,1,n)
		mx = max(mx,tj[i]);
	return mx;
}

int main()
{//closeSync;
#ifdef DEBUG
	//freopen("C:/Users/86159/Desktop/input.txt", "r", stdin);
	//freopen("C:/Users/86159/Desktop/output.txt", "w", stdout);
#endif
	//clock_t c1 = clock();
	int n,m;
	cin>>n>>m;
	init(n);
	rep (i,1,m)
	{
		int a,b;
		cin>>a>>b;
		tunion(a,b);
	}
	cout<<maxCount(n)<<endl;
	//cerr << "Time:" << clock() - c1 << "ms" <<endl;
    return 0;
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n; cin >> n;
  vector<ll> ar(n);
  for(int i = 0; i < n; i ++)
    cin >> ar[i];
  sort(ar.rbegin(), ar.rend());
  multiset<pair<ll, ll>> s;
  s.insert({ar[0], ar[0]});
  ll ans = 0;
  for(int i = 1; i < n; i ++){
    auto e = *s.rbegin();
    s.erase(s.find(e));
    ans += min(e.first, e.second);
    s.insert({min(e.first, ar[i]), max(e.first, ar[i])});
    s.insert({min(e.second, ar[i]), max(e.second, ar[i])});
  }
  cout << ans;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	set<string> st; 
	for (int i = 0; i < N; i++) {
		string S; cin >> S;
		st.insert(S);
	}
	cout << st.size() << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 19196
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

#diff = [a-b,b-c,c-d,d-e]

if e-a>k:
  ret = ":("
else:
  ret = "Yay!"

print(ret)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, s);
    CoutYn(s.find("AC") != string::npos);
}





Measured memory_bytes: 256
#include <stdio.h>

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

  int x, y, z;
  if(a <= b && b <= c) {
     x = a;
     y = b;
     z = c;
  } else if(a <= c && c <= b) {
    x = a;
    y = c;
    z = b;
  } else if(b <= c && c <= a) {
    x = b;
    y = c;
    z = a;
  } else if(b <= a && a <= c) {
    x = b;
    y = a;
    z = c;
  } else if(c <= a && a <= b) {
    x = c;
    y = a;
    z = b;
  } else {
    x = c;
    y = b;
    z = a;
  }
  printf("%d %d %d\n", x, y, z);
  return 0;
}

Measured memory_bytes: 2684
/**
 
coded by - pathakcodes  //revamped
**/


#include<bits/stdc++.h>
using namespace std ;


int main(){
    int n ;
    cin >> n ;
    
    vector<int> a(n+1,0) ;
    
    for(int i = 1 ; i < n+1 ; i++)
        cin >> a[i] ;
    
    vector<int> dp(n+1,0) ;
    dp[0] = 0 ;
    dp[1] = 0 ;
    dp[2] = abs(a[2] - a[1]) ;
    
    for(int i = 3 ; i < n+1 ; i++){
        dp[i] = min(abs(a[i]-a[i-1])+dp[i-1], abs(a[i]-a[i-2])+dp[i-2]);
    }

    cout << dp[n] <<endl ;
}

Measured memory_bytes: 4048
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A = N / 100;
    int B = N % 100;

    bool yymm = false;
    bool mmyy = false;


    if (1 <= B && B <= 12) {
        yymm = true;
    }   

    if (1 <= A && A <= 12) {
        mmyy = true;
    }   

    if (yymm && mmyy) {
        cout << "AMBIGUOUS" << endl;
    }   
    else if (yymm) {
        cout << "YYMM" << endl;
    }   
    else if(mmyy) {
        cout << "MMYY" << endl;
    }   
    else {
        cout << "NA" << endl;
    }   
    
}

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

int n;
int a[100000], b[100000];
int imos[100100];

int solve() {
	int cnt = 1;
	int ret = 0;
	for(int i = 1; i <= 100010; i++) {
		cnt += imos[i];
		if(cnt >= i) {
			ret = i - 1;
		}
	}
	return ret;
}

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

	while(cin >> n) {
		memset(imos, 0, sizeof imos);
		for(int i = 0; i < n; i++) {
			cin >> a[i] >> b[i];
			imos[a[i]]++;
			imos[b[i] + 1]--;
		}
		cout << solve() << endl;
	}
}

Measured memory_bytes: 4284
inp = list(map(lambda x: int(x), input().split(" ")))
H = inp[0]
W = inp[1]

LIM = 10**9 + 7

field = [""]*H

for i in range(H):
    field[i] = input()

dp = [[0]*W for i in range(H)]

dp[H-1][W-1] = 1

for i in range(H):
    for j in range(W):
        n = 0
        if(field[H-1-i][W-1-j] != "#"):
            if(H-i<H):
                n += dp[H-i][W-1-j]
            if(W-j<W):
                n += dp[H-1-i][W-j]
            if (n>0):
                if (n>=LIM):
                    n -= LIM
                dp[H-1-i][W-1-j] = n

print(dp[0][0])

Measured memory_bytes: 53612
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  string s;
  cin>>s;
  rep(i,4){
    bitset<2>ti=i;
    vector<int>tf(n+1);
    tf[0]=ti[0];
    tf[1]=ti[1];
    rep(j,n-1){
      tf[j+2]=(tf[j+1]!=1)^(s[j+1]!='o')^tf[j];
    }
    if(tf[n]==tf[0]&&tf[n-1]==((tf[0]!=1)^(s[0]!='o')^tf[1])){
      rep(j,n){
        if(tf[j])cout<<"S";
        else cout<<"W";
      }
      cout<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;

  return 0;

}


Measured memory_bytes: 976
#include<iostream>
#include<string>
using namespace std;
int ta[101],ha[101];
void judge(string taro,string hanako){
    for(int i=0;i<taro.size();i++){
        int count=1;
        for(char j='a';j<='z';j++){
            if(taro[i]==j){
                ta[i]=count;
            }
            count++;
        }
    }
    for(int i=0;i<hanako.size();i++){
        int count=1;
        for(char j='a';j<='z';j++){
            if(hanako[i]==j){
                ha[i]=count;
            }
            count++;
        }
    }
}
int main(){
    int n;
    cin>>n;
    string taro,hanako;
    int t=0,h=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<101;j++){
            ta[j]=0;
            ha[j]=0;
        }
        cin>>taro>>hanako;
        //cout<<judge(taro)<<" "<<judge(hanako)<<endl;
        judge(taro,hanako);
        for(int j=0;j<101;j++){
            if(ta[j]==0 && ha[j]==0){
                t+=1;
                h+=1;
                break;
            }
            if(ta[j]==ha[j]){continue;}
            else if(ta[j]<ha[j]){
                h+=3;
                break;
            }
            else if(ta[j]>ha[j]){
                t+=3;
                break;
            }
        }
    }
    cout<<t<<" "<<h<<endl;
}



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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  ll n,a,b;cin>>n>>a>>b;
  ll ans=0;
  ans+=n/(a+b)*a;
  ans+=min(n%(a+b),a);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)

	if n == 3 {
		fmt.Fprintln(writer, fmt.Sprintf("%d %d %d", 2, 3, 25))
		return
	}

	fmt.Fprintln(writer, 1*2)
	fmt.Fprintln(writer, 2*2)
	fmt.Fprintln(writer, 1*3)
	fmt.Fprintln(writer, 3*3)
	n -= 4
	for i := 1; (i*3+2)*2 <= 30000 && n >= 2; i++ {
		fmt.Fprintln(writer, (i*3+1)*2)
		fmt.Fprintln(writer, (i*3+2)*2)
		n -= 2
	}
	for i := 1; (i*4+3)*3 <= 30000 && n >= 2; i++ {
		fmt.Fprintln(writer, (i*4+1)*3)
		fmt.Fprintln(writer, (i*4+3)*3)
		n -= 2
	}

	for i := n - 1; i >= 0; i-- {
		fmt.Fprintln(writer, (i+1)*6)
	}
}


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

using namespace std;

void solve() {
        int x;
        cin >> x;
        if (x >= 30) cout << "Yes" << endl;
        else cout << "No" << endl;
}


int main() {
#ifdef QWERTY
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
#endif
        ios_base::sync_with_stdio(false);


        int t = 1;
//        cin >> t;

        for (int i = 1; i <= t; i++) {
//                cout << "Case #" << i << ':' << endl;
                solve();
        }


        return 0;
}

Measured memory_bytes: 3668
#include<stdio.h>

int p[305],t[1005][4],a,b,c,i,k,n,*q,u;
int main()
{
	for(;scanf("%d%d%d",&a,&b,&c),a;)
	{
		for(i=1;i<=a+b+c;i++)
			p[i]=2;
		scanf("%d",&k);
		for(i=0,q=t[0];i<k;i++,q+=4)
		{
			scanf("%d%d%d%d",&q[0],&q[1],&q[2],&q[3]);
			if(q[3]==1)
				p[q[0]]=p[q[1]]=p[q[2]]=1;
		}
		for(i=0,q=t[0];i<k;i++,q+=4)
		{
			if(q[3]==0)
			{
				if(p[q[0]]==1&&p[q[1]]==1)p[q[2]]=0;
				else if(p[q[0]]==1&&p[q[2]]==1)p[q[1]]=0;
				else if(p[q[1]]==1&&p[q[2]]==1)p[q[0]]=0;
			}
		}
		for(i=1;i<=a+b+c;i++)
			printf("%d\n",p[i]);
	}
	return 0;
}

Measured memory_bytes: 616