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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

inline bool isSmall(char c){ return 'a' <= c && c <= 'z'; }

bool ok;
map<string, int> dic;

int calc(string& mol, int& pos){
    int ret;

    if(mol[pos] == '('){
        pos++;
        ret = calc(mol, pos);
        pos++;
    }
    else {
        string atom;
        atom.pb(mol[pos++]);
        if(pos < mol.size() && isSmall(mol[pos])){
            atom.pb(mol[pos++]);
        }

        if(dic[atom] == 0){
            ok = false;
        }

        ret = dic[atom];
    }

    int num = 0;
    while(pos < mol.size() && isdigit(mol[pos])){
        num = 10 * num + (mol[pos++] - '0');
    }
    if(num != 0) ret *= num;

    if(pos < mol.size() && mol[pos] != ')') ret += calc(mol, pos);

    return ret;
}

int main(void){
    for(string str; cin >> str, str != "END_OF_FIRST_PART"; ){
        cin >> dic[str];
    }

    for(string mol; cin >> mol, mol != "0";){
        ok = true;

        int pos = 0, res = calc(mol, pos);
        if(ok) cout << res << endl;
        else cout << "UNKNOWN" << endl;
    }

	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

using P = pair<int, int>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, M;
    cin >> H >> W >> M;
    vector<P> v(M);
    vector<vector<int>> hs(H), ws(W);
    for(int i = 0; i < M; i++) {
        int h, w;
        cin >> h >> w;
        h--;
        w--;
        v[i] = P(h, w);
        hs[h].emplace_back(w);
        ws[w].emplace_back(h);
    }
    int mxh = 0, mxw = 0;
    for(int i = 0; i < H; i++) {
        chmax(mxh, (int)hs[i].size());
    }
    for(int i = 0; i < W; i++) {
        chmax(mxw, (int)ws[i].size());
    }
    set<int> mxh_s, mxw_s;
    for(int i = 0; i < H; i++) {
        if(mxh == (int)hs[i].size()) {
            mxh_s.emplace(i);
        }
    }
    for(int i = 0; i < W; i++) {
        if(mxw == (int)ws[i].size()) {
            mxw_s.emplace(i);
        }
    }
    ll cnt = 0;
    for(int i = 0; i < M; i++) {
        if(mxh_s.count(v[i].first) && mxw_s.count(v[i].second)) {
            cnt++;
        }
    }
    if(cnt == (ll)mxh_s.size() * (ll)mxw_s.size()) {
        cout << mxh + mxw - 1 << endl;
    } else {
        cout << mxh + mxw << endl;
    }
}

Measured memory_bytes: 66556
#include<iostream>
using namespace std;
int a[100001],b[100001],c[100001];
int dp[100001][3];
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i]>>c[i];
	for(int i=1;i<=n;i++)
	{
		dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a[i];
		dp[i][2]=max(dp[i-1][1],dp[i-1][3])+b[i];
		dp[i][3]=max(dp[i-1][1],dp[i-1][2])+c[i];
	}
	cout<<max(max(dp[n][1],dp[n][2]),dp[n][3]);
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  unordered_map<uint64_t, int> m;
  int n;
  cin >> n;
  uint64_t ans = 0;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    uint64_t r = 0;
    for (char c : s) {
      r = r * 27 + c - 'a' + 1;
    }
    ans += m[r]++;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4388
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 

int main(){

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

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

	for(int i=0;i<n;i++) cout<<cnt[i]<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    int val;
    int cnt = 0;
    for(int i=0; i<N; i++){
        cin >> val;
        if(val >= K)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()


int main() {
    ll X;
    cin >> X;
    for (ll A = -1000; A <= 1000; A++) for (ll B = -1000; B <= 1000; B++) {
        if (A * A * A * A * A - B * B * B * B * B == X) {
            cout << A << " " << B << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
N,K,Q = map(int, input().split())
A = list()
H = list()
for i in range(Q):
    A.append(int(input()))
for i in range(N):
    H.append(int(0))

noko = Q-K
for a in A:
    H[a-1] += 1

for h in H:
    if h > noko:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 8640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int ans=0;
  int L=S.length();
  for(int i=0; i<L/2; i++){
  	if(S.at(i)!=S.at(L-i-1))ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,p;
  cin >> n >> p;
  if(n==1){
    cout << p << endl;
  }
  else if(p==1||n>40){
    cout << 1 << endl;
  }
  else{
    ll k=sqrt(p);
    k++;
    ll ans=0;
    for(ll i=k;i>=1;i--){
      ll m=p;
      ll cnt=0;
      while(m%i==0&&cnt<n){
        cnt++;
        m /=i;
      }
      if(cnt==n){
        cout << i << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	vector<P> p(n);
	REP(i,n) cin >> p[i].second >> p[i].first;
	sort(p.begin(), p.end());
	int sum = 0;
	REP(i,n){
		sum += p[i].second;
		if(sum > p[i].first){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scr =new Scanner(System.in);
	
		int A = scr.nextInt();
		int B = scr.nextInt();
		int c = scr.nextInt();
		int K = scr.nextInt();
		
		int X = K-A;//A���Ƃ��āC���ƂƂ�K�v�̂��閇��
		int Y = K-X;//A�̖���
		
		int Z = X-B;//
		
		int max;
	
		if(X < 0) {
			System.out.println(K);
		}else {
			if(X-B < 0) {
				System.out.println(Y);
			}else {
				max = (Z*-1)+(Y);
				System.out.println(max);
			}
		}
		
		
	
	}
}

Measured memory_bytes: 35556
#include<stdio.h>
#include<stdlib.h>

int up(const void *a ,const void *b){
  return *(int *)a - *(int *)b;
}

int main(void){
  int n , c , k;
  scanf("%d %d %d",&n ,&c ,&k);

  int t[n+1];
  for(int i = 0;i < n;i ++){
    scanf("%d",&t[i]);
  }

  t[n] = 1000000000;
  qsort(t,n+1,sizeof(int),up);

  int start , count = 0 , ninn;
  int i = 0, j;
   while(i < n){
     start = t[i];
     ninn = 1;
     i ++;
     while(t[i] <= start + k && ninn < c){
       i ++;
       ninn ++;
     }
     count ++;
   }

   printf("%d\n",count);

   return 0;
}

Measured memory_bytes: 2264
import java.util.Scanner;

//Next Trip
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int s = 0;
			int ans = 0;
			for(int i=1;i<=12;i++){
				s += sc.nextInt()-sc.nextInt();
				if(ans==0&&s>=n)ans=i;
			}
			System.out.println(ans==0?"NA":ans);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n; cin >> n;
  if(n%2==1){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  for(ll i=10; i<=n; i*=5){
    ans += n/i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

int main(void){
    int i,a;

    for(i=1; i<=10000; i++){
        scanf("%d",&a);

        if(a==0){
            break;
        }else{
            printf("Case %d: %d\n",i,a);
        }
    }

    return 0;
}


Measured memory_bytes: 2064
let string_rev s =
  let len = String.length s in
  String.init len (fun i -> s.[len - 1 - i]);;
let str_eq s1 s2 = s1=s2;;
let f s1 s2 = if s1=(string_rev s2) then "YES" else "NO";;
let () = Scanf.scanf "%s %s" f |> Printf.printf "%s\n"

Measured memory_bytes: 384
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    ll n, a, b;
    cin >> n >> a >> b;
    ll minsum = a * (n-1) + b;
    ll maxsum = b * (n-1) + a;
    cout << max(0LL, maxsum - minsum + 1) << endl;
}


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

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char& ch) {
	string s = "";
	s += ch;
	return "'" + s + "', ";
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL_DEFINE
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
   
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> pii;
const int mod = (int) 1000000007; // 998244353;
const int inf = (int) 2e18;



int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(9);
	#ifdef LOCAL_DEFINE
		freopen("in.txt", "rt", stdin);
	#endif
	
	
	int l, r;
	cin >> l >> r;
	int d;
	cin >> d;
	cout << (r / d - (l - 1) / d) << '\n';
	
	return 0;
}






Measured memory_bytes: 3636
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define pq priority_queue
#define um unordered_map
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define what_is(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    string s;
    cin >> s;
    for (int i = 1; i < s.ln; i++)
        if (s[i] == s[i - 1]) {
            cout << "Bad";
            return 0;
        }
    cout << "Good";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <vector>
#include <numeric>
#include<string>
#include <map>
 
using namespace std;
 
#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))
#define PI 3.141592653589793
 
 
 
int main() {
    ll a;
    cin >> a;
    a = a + a * a + a * a * a;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 3632
from heapq import*
def main():
  h,w=map(int,input().split())
  s=[input()for _ in range(h)]
  g=h*w+1
  e=[[]for _ in range(g)]
  for i in range(h):
    for j in range(w):
      for y,x in((i+1,j),(i,j+1)):
        if y<h and x<w:
          if s[i][j]=='.'and s[y][x]!='.':
            e[i*w+j]+=(1,y*w+x),
          else:
            e[i*w+j]+=(0,y*w+x),
  e[g-1]+=(s[0][0]!='.',0),
  q=[g-1]
  d=[10**12]*g
  while q:
    c=heappop(q)
    c,v=c//g,c%g
    if c>d[v]:continue
    d[v]=c
    for x,w in e[v]:
      x+=c
      if d[w]>x:
        d[w]=x
        heappush(q,x*g+w)
  print(d[g-2])
main()

Measured memory_bytes: 6132
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    cout<<(1000-n%1000)%1000<<endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ii> P;
typedef unsigned long long int ull;
const int MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e9;

int main(){
    int n,ma,mb;cin>>n>>ma>>mb;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
    int dp[n+1][401][401];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=400;j++){
            for(int k=0;k<=400;k++){
                dp[i][j][k]=INF;
            }
        }
    }
    dp[0][0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=400;j++){
            for(int k=0;k<=400;k++){
                dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
                if(j>=a[i]&&k>=b[i]){
                    dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j-a[i]][k-b[i]]+c[i]);
                }
            }
        }
    }
    int ans=INF;
  for(int i=1;i*ma<=400&&i*mb<=400;i++){
    ans=min(ans,dp[n][i*ma][i*mb]);
  }
    if(ans==INF) cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 29356
#include<iostream>
#include<string>
using namespace std;
int cnt,a;
int main()
{ 
  string s;
  cin >> s;
  bool can = 1;
  a = s.size();
  if(s[0]!='A')
  {
    can = 0;
  }
  if(s[1]=='C' ||s[a-1]=='C')can=0;
  for (int i = 2;i<a-1;i++)
  {
    if(s[i]=='C')
      cnt++;
    if(cnt>1)
    {
      can = 0;
      break;
    }
  }
  if(cnt==0)can=0;
  for (int i = 1; i < a;i++)
  {
    if(s[i]!='A'&&s[i]!='C')
    {
      if(s[i]<'a')
      {
        can = 0;
        break;
      }
    }
  }
  cout << (can ? "AC" : "WA") << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
char x[50];
int ch[1000];
int main(void){
    int i,fg;
    for(i=0;i<50;i++){
        x[i]=0;
    }
    for(i=0;i<1000;i++){
        ch[i]=0;
    }
    scanf("%s",&x);
    i=0;
    while(1){
        if(i==50){
            break;
        }
        if(x[i]==0){
            break;
        }
        ch[x[i]]++;
        i++;
    }
    fg=0;
    for(i=0;i<1000;i++){
        if(ch[i]>1)fg++;
    }
    if(fg>0){
        printf("no\n");
    }else{
        printf("yes\n");
    }
    return 0;
}



Measured memory_bytes: 128
H, W = map(int, input().split())
S = []
S.append(['#' for _ in range(W+2)])
for _ in range(H):
  s = input()
  s = '#' + s + '#'
  S.append([])
  for k in range(W+2):
    S[-1].append(s[k])
S.append(['#' for _ in range(W+2)])
b = 0
start = []
for h in range(1, H+1):
  for w in range(1, W+1):
    if S[h][w] == '.':
      c = 0
      b += 1
      if S[h+1][w] == '.':
        c += 1
      if S[h-1][w] == '.':
        c += 1
      if S[h][w+1] == '.':
        c += 1
      if S[h][w-1] == '.':
        c += 1
      if c == 1:
        start.append([h, w])
if len(start) == 0:
  for h in range(1, H+1):
    for w in range(1, W+1):
      if S[h][w] == '.':
        c = 0
        if S[h+1][w] == '.':
          c += 1
        if S[h-1][w] == '.':
          c += 1
        if S[h][w+1] == '.':
          c += 1
        if S[h][w-1] == '.':
          c += 1
        if c == 2:
          start.append([h, w])

def solve(nowh, noww, point):
  counter[nowh][noww] = point
  flag = True
  if counter[nowh+1][noww] > point + 1:
    solve(nowh+1, noww, point+1)
    flag = False
  if counter[nowh-1][noww] > point + 1:
    solve(nowh-1, noww, point+1)
    flag = False
  if counter[nowh][noww+1] > point + 1:
    solve(nowh, noww+1, point+1)
    flag = False
  if counter[nowh][noww-1] > point + 1:
    solve(nowh, noww-1, point+1)
    flag = False
  if flag:
    return 0

ans = 0
for item in start:
  original_counter = [[b for _ in range(W+2)] for _ in range(H+2)]
  for k in range(H+2):
    for j in range(W+2):
      if S[k][j] == '#':
        original_counter[k][j] = -1
  counter = original_counter
  solve(item[0], item[1], 0)
  anskouho = 0
  for h in range(1, H+1):
    for w in range(1, W+1):
      anskouho = max(anskouho, counter[h][w])
  ans = max(ans, anskouho)

print(ans)

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	int N; cin >> N;
	vector<int> C(N - 1), S(N - 1), F(N - 1);
	for(int i = 0; i < N - 1; i++) cin >> C[i] >> S[i] >> F[i];
	int t = 0;
	for(int j = 0; j < N - 1; j++) {
		t = 0;
		for(int i = j; i < N - 1; i++) {
			if(t < S[i]) t = S[i];
			if(t % F[i] != 0) t += F[i] - (t % F[i]);
			t += C[i];
		}
		cout << t << endl;
	}
	cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 3588
open Printf
open Scanf

let rec seq s n =
  if s * s >= n then []
  else
    s :: seq (s + 1) n
  
let solve n =
  let ac = Array.make (n + 1) 0 in
  let ls = seq 1 n in
  List.iter (fun x ->
      List.iter (fun y ->
          List.iter (fun z ->
              let m = x * x + y * y + z * z + x * y + y * z + z * x in
              if m <= n then ac.(m) <- ac.(m) + 1
            ) ls) ls ) ls;
  for i = 1 to n do
    printf "%d\n" ac.(i)
  done

let () =
  scanf "%d " solve


Measured memory_bytes: 5876
#include <iostream>
//#include <conio.h>
using namespace std;
//selection sort
int main()
{
	int n;
	cin>>n;
	int dem =0;
	int a[100000];
	for (int i =0; i < n; i++)
		cin>>a[i];
	for (int i = 0; i < n - 1; i++)
	{
		int min = i;
		for (int j = i + 1; j < n; j++)
		{
			if (a[j] < a[min])
				min = j;
		}        
		if (min != i)
			{
				int temp = a[min];
				a[min] = a[i];
				a[i] = temp;
				dem++;
			}
	}
	cout<<a[0];
	for (int i = 1; i < n; i++)
		cout << " "<< a[i];
	cout<< endl;
	cout<< dem << endl;
	/*getch();*/
	return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
 
int main() {

    string patternStr;
    cin >> patternStr;

    string scanStr = "";
    int count = 0;

    while (true)
    {
        cin >> scanStr;
        if (scanStr == "END_OF_TEXT")
        {
            break;
        }
        transform(scanStr.begin(), scanStr.end(), scanStr.begin(), ::tolower);
        if ( scanStr == patternStr )
        {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 3280
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,x,t = ma()

print(t*math.ceil(n/x))


Measured memory_bytes: 9480
<?php
$input = fscanf(STDIN, '%d %d');

if ($input[0] > $input[1]) {
    echo 0 . "\n";
    exit;
}

$count = 0;
for ($i = $input[0]; $i <= $input[1]; $i++) {
    if (substr($i, 0, 2) === substr($i, -1) . substr($i, -2, 1)) {
        $count++;
    }
}

echo $count . "\n";

Measured memory_bytes: 4728
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>

#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define endl "\n"
#define INF (ll)ll_MAX

typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;

const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;

using namespace std;

void solve()
{    
    int n , m ; 
    cin>>n>>m ;
    char mat[n][m] ;
    int x1 , y1  , x2 , y2 ; 
    cin>>x1>>y1>>x2>>y2 ;
    x1--;y1--;x2--;y2--;
    rep(i , n){
        rep(j , m)cin>>mat[i][j] ;
    }
    int dis[n][m];
    rep(i , n){
        rep(j , m){
            dis[i][j] = 1e9 ;
        }
    }
    dis[x1][y1] = 0 ;
    deque<pair<int,int>>q ; 
    q.push_front({x1 , y1}) ;
    while(!q.empty()){
        auto node = q.front() ; 
        q.pop_front() ;
        int i = node.fi  , j = node.se ;
        if(i-1>=0 && mat[i-1][j]!='#' &&  dis[i-1][j]>dis[i][j]){
            dis[i-1][j] = dis[i][j] ; 
            q.push_front({i-1 , j}) ;
        }
        if(i+1<n && mat[i+1][j]!='#' && dis[i+1][j]>dis[i][j]){
            dis[i+1][j] = dis[i][j] ;
            q.push_front({i+1 , j}) ;
        }
        if(j+1<m && mat[i][j+1]!='#' && dis[i][j+1]>dis[i][j]){
            dis[i][j+1] = dis[i][j]; 
            q.push_front({i , j+1}) ;
        }
        if(j-1>=0 && mat[i][j-1]!='#' &&dis[i][j-1]>dis[i][j]){
            dis[i][j-1] = dis[i][j] ;
            q.push_front({i  ,  j-1}) ;
        }
        repu(ind , i-2 , i+2){
            repu(ind1 , j-2 , j+2){
                if(ind1>=0 && ind1<m && ind<n && ind>=0 && mat[ind][ind1]!='#' && dis[ind][ind1]>dis[i][j]+1){
                    dis[ind][ind1] = dis[i][j]+1 ;
                    q.push_back({ind , ind1}) ;
                }
            }
        }
    }
    if(dis[x2][y2]==1e9){
        cout<<-1<<endl;
    }
    else{
        cout<<dis[x2][y2]<<endl;
    }
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    //cout<<"helo";
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    //  cin>>t;

    while(t--)
    {
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

}

Measured memory_bytes: 8652
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  int N;
  int Apre=0;
  int result;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> A >> B;

    if(A > Apre){
      result = A + B;
      Apre = A;
    }
  }
  cout << result << endl;
 return 0;
}

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

const int N = 1e5 + 10;

int n;
vector <pair <ll, ll>> v;
set <ll> s;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		ll a;
		cin >> a;
		v.push_back({a, i});
	}
	sort(v.begin(), v.end());
	ll ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		ll a = v[i].second;
		ll b = v[i].first;
		s.insert(a);
		auto x = s.find(a);
		ll l1 = -1, l2 = -1, r1 = n, r2 = n;
		if (x != s.begin()) {
			x--;
			l1 = *x;
			if (x != s.begin()) {
				x--;
				l2 = *x;
			}
		}
		x = s.find(a);
		x++;
		if (x != s.end()) {
			r1 = *x;
			x++;
			if (x != s.end())
				r2 = *x; 
		}
		ll k = l1 - l2;
		ll p = r1 - a;
		ans += k * p * b;
		k = r2 - r1;
		p = a - l1;
		ans += k * p * b;
//		cout << ans << " ******" << endl;
//		cout << l1 << " " << l2 << "    " << r1 << " " << r2 << " &&&&" << endl;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 9484
#include <bits/stdc++.h>
using namespace std;
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;}
using Int = long long;
const char newl = '\n';


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin>>n;
  vector<int> cs(n);
  for(int i=0;i<n;i++) cin>>cs[i],cs[i]--;

  vector<vector<int>> G(n);
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  using ll = long long;
  ll all=0;
  vector<ll> cnt(n,0),sub(n,0);

  vector<ll> ans(n,(ll)n*(n-1)/2);
  MFP([&](auto dfs,int v,int p)->int{
    sub[v]=1;
    ll bfr=cnt[cs[v]];
    for(int u:G[v]){
      if(u==p) continue;
      ll pre=all-cnt[cs[v]];
      sub[v]+=dfs(u,v);
      ll nxt=all-cnt[cs[v]];
      ans[cs[v]]-=(nxt-pre)*(nxt-pre-1)/2;
    }
    cnt[cs[v]]=bfr+sub[v];
    all++;
    return sub[v];
  })(0,-1);

  for(int c=0;c<n;c++){
    ll pre=0,nxt=n-cnt[c];
    ans[c]-=(nxt-pre)*(nxt-pre-1)/2;
  }
  for(int c:cs) ans[c]++;

  for(ll a:ans) cout<<a<<newl;
  return 0;
}


Measured memory_bytes: 47692
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;

bool a[102];
int n, k, d;

int main(){
    scan(n, k);
    while(k--){
        int m;
        scan(m);
        while(m--){
            scan(d);
            a[d] = 1;
        }
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        cnt += !a[i];
    }
    print(cnt);
    
    
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最小公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans = b-a+1;
    ans += (a-1)/c;
    ans -= b/c;
    ans += (a-1)/d;
    ans -= b/d;
    ans -= (a-1)/lcm(c,d);
    ans += b/lcm(c,d);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100

int a[N][N];
int d[N+1];
void matrixChain(int n){
  int i,j,k,l,m;
  for(i=0;i<=n;i++){
    a[i][i]=0;
  }
  for(j=2;j<=n+1;j++){
    for(i = 1;i < n-j+2;i++){
      l = i + j - 1;
      a[i][l] = 1000000;
      for(k = i;k < l;k++){
	m = a[i][k] + a[k+1][l] + d[i-1]*d[k]*d[l];
	if(a[i][l]>m){
	  a[i][l]=m;
	}
      }
    }
  }
}

int main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&d[i],&d[i+1]);
  }
  matrixChain(n);
  printf("%d\n",a[1][n]);
  
  return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a[4000], s[4000], dp[2002][2002], pos[2][2001], x[2][4000][2001];

int main() {
	cin >> n;
	inc(i, 2 * n) { string ss; cin >> ss >> a[i]; a[i]--; s[i] = (ss == "B" ? 1 : 0); }
	
	inc(i, 2 * n) { pos[s[i]][a[i]] = i; }
	
	inc(k, 2) {
	incII(v, 0, n) {
		int c = 0;
		dec(i, 2 * n) {
			x[k][i][v] = c;
			if(s[i] == k && a[i] < v) { c++; }
		}
	}
	}
	
	incII(i, 0, n) {
	incII(j, 0, n) {
		dp[i][j] = 1e8;
	}
	}
	dp[0][0] = 0;
	
	incII(i, 0, n) {
	incII(j, 0, n) {
		int pb = pos[0][i];
		int pw = pos[1][j];
		setmin(dp[i + 1][j], dp[i][j] + x[0][pb][i] + x[1][pb][j]);
		setmin(dp[i][j + 1], dp[i][j] + x[0][pw][i] + x[1][pw][j]);
	}
	}
	
	cout << dp[n][n] << endl;
	
	return 0;
}


Measured memory_bytes: 78464
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, M;
	cin >> N >> M;
	bool A[10][10] = {};
	rep(i, M) {
		int k;
		cin >> k;
		rep(j, k) {
			int s;
			cin >> s;
			A[s - 1][i] = true;
		}
	}
	int P[10];
	rep(i, M) cin >> P[i];

	int r = 0;
	rep(i, M) {
		bool atta = false;
		for (int j = r; j < N; j++) {
			if (A[j][i]) {
				atta = true;
				rep(k, M) swap(A[r][k], A[j][k]);
				break;
			}
		}
		if (atta) {
			for (int j = r + 1; j < N; j++) {
				if (A[j][i]) {
					rep(k, M) A[j][k] ^= A[r][k];
				}
			}
			if (P[i]) {
				rep(k, M) P[k] ^= (int)A[r][k];
			}
			r++;
		}
	}

	int OK = 1;
	rep(i, M) if (P[i]) OK = 0;

	if (OK) co(1 << (N - r));
	else co(0);

	Would you please return 0;
}

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

using namespace std;
using ll = long long;

const ll mod = 1000000007;
ll inv (ll x) {
	ll a = 1;
	ll m = mod - 2;
	for (ll q = 31; q >= 0; q--) {
		a = a*a;
		a %= mod;
		if (m >> q & 1) a *= x;
		a %= mod;
		}
	return a;
}
int main() {
	ll s;
	cin >> s;
	ll ans = 0;
	if (s < 3) {
		ans = s / 3;
		cout << ans << endl;
		return 0;
	}
	for (ll i = 1; i * 3 <= s; i++) {
		ll n = s - (i * 3);
		ll k = i - 1;
		ll c = 1;
		ll div = 1;
		n += k;
		rep(j, k) {
			c *= n;
			c %= mod;
			n--;
			div *= (j + 1);
			div %= mod;
		}
		c *= inv(div);
		ans += c;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <stdio.h>
#include <math.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N;
int a[200000];

int main(){
  cin >> N;
  fill(a, a+100010, 0);
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    a[x]++; a[x+1]++; a[x+2]++;
  }

  int ma = 0;
  for(int i = 0; i < 100010; i++){
    if(a[i] > ma) ma = a[i];
  }

  cout << ma << endl;


  return 0;
}


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

using namespace std;

int main() {
    long long a, b, n;
    cin >> a >> b >> n;

    long long ans = 0;

//    long long k = 0;
//    while(k*(b-1)<=n) {
//        long long x = k*(b-1);
//        ans = max(ans, (a*x/b)-a*(x/b));
//        k++;
//    }
    long long k = n / b;
    long long x = k*(b-1);
    ans = max(ans, (a*x/b)-a*(x/b));

    ans = max(ans, (a*n/b)-a*(n/b));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3676
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
H,A = map(int,input().split())
ans = H//A
#print(ans)
if H<=A:
    print("1")
elif H%A==0:
    print(ans)
else:
    print(ans+1)
    





Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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 <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N,K;
    cin>>N>>K;
    vll A(N+1);
    for (int i = 1; i <= N; i++)
    {
        cin>>A[i];
    }
    for (int i = K+1; i <= N; i++)
    {
        if(A[i]>A[i-K])
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 4840
import sys
from _operator import itemgetter
from fractions import gcd

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

a, b = na()
g = gcd(a, b)
li = make_divisors(g)
ct = 1
for num in li:
    if is_prime(num):
        ct += 1
print(ct)




Measured memory_bytes: 5328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;

    string cand[4];
    cand[0] += "SS";
    cand[1] += "SW";
    cand[2] += "WS";
    cand[3] += "WW";


    REP(i,4){
        FOR(j,1,N-1){
            if(cand[i][j] == 'S' && S[j] == 'o'){
                cand[i] += cand[i][j-1];
            }

            if(cand[i][j] == 'S' && S[j] == 'x'){
                char tmp = cand[i][j-1];
                if(tmp == 'S') cand[i] += 'W';
                else cand[i] += 'S';
            }

            if(cand[i][j] == 'W' && S[j] == 'o'){
                char tmp = cand[i][j-1];
                if(tmp == 'S') cand[i] += 'W';
                else cand[i] += 'S';
            }

            if(cand[i][j] == 'W' && S[j] == 'x'){
                cand[i] += cand[i][j-1];
            }
        }

        bool ok = 1;
        // check

        if(cand[i][N-1] == 'S'){
            if(S[N-1] == 'o'){if(cand[i][N-2] != cand[i][0]) ok = 0;}
            else if(cand[i][N-2] == cand[i][0]) ok = 0;
        }
        else{
            if(S[N-1] == 'o'){if(cand[i][N-2] == cand[i][0]) ok = 0;}
            else if(cand[i][N-2] != cand[i][0]) ok = 0;
        }

        if(cand[i][0] == 'S'){
            if(S[0] == 'o'){if(cand[i][N-1] != cand[i][1]) ok = 0;}
            else if(cand[i][N-1] == cand[i][1]) ok = 0;
        }
        else{
            if(S[0] == 'o'){if(cand[i][N-1] == cand[i][1]) ok = 0;}
            else if(cand[i][N-1] != cand[i][1]) ok = 0;
        }

        if(ok){
            cout << cand[i] << endl;
            return 0;
        }


    }
    cout << "-1" << endl;


}

Measured memory_bytes: 976
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

int n;
double xs[50], ys[50];

template<class F>
double ternary_search(double l, double r, double eps, F f) {
    while (r - l > eps) {
        double ml = l + (r - l) / 3, mr = r - (r - l) / 3;
        if (f(ml) < f(mr)) {
            r = mr;
        } else {
            l = ml;
        }
    }
    return l + (r - l) / 2;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> xs[i] >> ys[i];
    }
    double r = 0;
    ternary_search(-1000, 1000, 1e-10, [&](double x) {
        ternary_search(-1000, 1000, 1e-10, [&](double y) {
            r = 0; 
            for (int i = 0; i < n; ++i) {
                r = max(r, hypot(x - xs[i], y - ys[i]));
            }
            return r;
        });
        return r;
    });
    printf("%.10f\n", r);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>


int main(void) {
	using namespace std;
	int auni[4][3][10];
	int i,j,k;
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 3; j++) {
			for (k = 0; k < 10; k++) {
				auni[i][j][k] = 0;
			}
		}
	}
	int n, b, f, r, v;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		auni[b-1][f-1][r-1] += v;
	}
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 3; j++) {
			for (k = 0; k < 10; k++) {
				cout << ' ' << auni[i][j][k];
			}
			cout << endl;
		}
		if (i == 3)continue;
		cout << "####################" << endl;
	}
	
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int,k,x);
  out((500*k>=x)?"Yes":"No");
}


Measured memory_bytes: 256
N,C=map(int,input().split())
s=[0 for i in range(N)];t=[0 for i in range(N)];c=[0 for i in range(N)]
MT=0
for i in range(N):
    s[i],t[i],c[i]=map(int,input().split())
    s[i]-=1
    t[i]-=1
    c[i]-=1
for i in range(N):
    if t[i]>MT:
        MT=t[i]
CBC=[[0 for i in range(MT+1)] for i in range(C)]
for i in range(N):
    for j in range(s[i]-1,t[i]):
        CBC[c[i]][j]=1
MaxC=0
for i in range(MT+1):
    NowC=0
    for j in range(C):
        if CBC[j][i]==1:
            NowC+=1
    if NowC>MaxC:
        MaxC=NowC
print(MaxC)


Measured memory_bytes: 35376