akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n, f[10010];

int main() {
	cin>>n;
	for (int x=1; x<150; x++) {
		for (int y=1; y<150; y++) {
			for (int z=1; z<150; z++) {
				//cout<<x<<" "<<y<<" "<<z<<endl;
				ll hasil=(x+y+z);
				//cout<<"tambah: "<<hasil<<endl;
				hasil*=hasil;
				//cout<<"kuadrat: "<<hasil<<endl;
				hasil-=(x*y+y*z+z*x);
				if (hasil<=10000)f[hasil]++;
				//cout<<hasil<<endl;
			}
		}
	}
	for (int i=1; i<=n; i++) {
		cout<<f[i]<<endl;
	}
}



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

template <typename T>
using lim = numeric_limits<T>;

const int MOD = 1e9+7;
const int N = 3e5;
const int MAXN = 1e5+1;

ll top[MAXN], bot[MAXN];
ll fact[N];
ll invfact[N];

ll modpow(ll b, ll e){
	ll ans = 1;
	while(e){
		if (e&1) ans = ans*b%MOD;
		e >>= 1;
		b = b*b%MOD;
	}
	return ans;
}

ll inv(ll b){
	return modpow(b, MOD-2);
}

void compute(){
	fact[0] = 1;
	for (ll i = 1; i < N; i++) fact[i] = i*fact[i-1]%MOD;
	
	invfact[N-1] = inv(fact[N-1]);

	for (ll i = N-2; i >= 0; i--) invfact[i] = invfact[i+1]*(i+1)%MOD;
}

ll perm(ll n, ll k){
	return fact[n]*invfact[n-k]%MOD;
}
ll choose(ll n, ll k){
	return perm(n,k)*invfact[k]%MOD;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	compute();
	ll h, w, a, b;
	cin >> h >> w >> a >> b;
	ll ans = 0;
	//cout << h << " " << w << " " << a << " " << b << endl;
	for (int i = b; i < w; i++){
		top[i-b] = choose(i+h-a-1,i);
		bot[i-b] = choose(w-i+a-2,a-1);
		ans = (ans+top[i-b]*bot[i-b]%MOD)%MOD;
	}
	
	ans = (ans+MOD)%MOD;
	cout << ans << endl;
}

Measured memory_bytes: 6528
import heapq

def change(i):
    if i == ".":
        return 500
    return -1

h, w = map(int, input().split())

maze = []

for _ in range(h):
    maze.append([change(i) for i in input()])

B = 0
for _ in maze:
    B += _.count(-1)

l = []

maze[0][0] = 1
heapq.heappush(l, (1, 0, 0))
while len(l) > 0:
    S, H, W = heapq.heappop(l)
    if (H, W) == (h-1, w-1):
        break
    
    for i in range(-1, 2, 2):
        y = H+i
        if y >= 0 and y < h:
            if maze[H][W]+1 < maze[y][W]:
                maze[y][W] = maze[H][W]+1
                heapq.heappush(l, (maze[H][W]-1+h-y+w-W,y, W))
    for i in range(-1, 2, 2):
        x = W+i
        if x >= 0 and x < w:
            if maze[H][W]+1 < maze[H][x]:
                maze[H][x] = maze[H][W]+1
                heapq.heappush(l, (maze[H][W]-1+h-H+w-x, H, x))

if maze[-1][-1] == 500:
    print(-1)
else:
    print(h*w-B-maze[-1][-1]) 

Measured memory_bytes: 3188
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll n, t;
    cin >> n >> t;
    ll ans = 0;
    ll prev_t;
    cin >> prev_t;
    for(int i = 1; i < n; ++i){
        ll next_t;
        cin >> next_t;
        ans += min(t, next_t - prev_t);
        prev_t = next_t;
    }
    ans += t;
    cout << ans << endl;
    return 0;
}


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


int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N) {
    cin >> a[i];
    --a[i];
  }
  //a[i] > i にはならない
  vector<int> res;

  rep(i,N) {
    int p = -1;
    for(int j = a.size() - 1; j >= 0; j--) {
      if(a[j] == j) {
        p = j;
        break;
      }
    }
    if(p == -1) {
      puts("-1");
      return 0;
    }

    res.push_back(p+1);// 0-indexed
    a.erase(a.begin() + p);
  }
  reverse(res.begin(),res.end());
  for(auto e : res) cout << e << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int n, t, tc, tt, i, min;
	if (scanf("%d%d", &n, &t) == 0) return 1;
	min = 1001;
	for (i = 0; i < n; i++) {
		if (scanf("%d%d", &tc, &tt) == 0) return 1;
		if (tt <= t && min > tc) min = tc;
	}
	if (min == 1001) printf("TLE");
	else printf("%d", min);
}


Measured memory_bytes: 128
#include <iostream>
#include<cmath>
using namespace std;
#define ll long long int 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
	

 	fastio;
 	int l,r,d;
 	cin>>l>>r>>d;
 	int cnt=0;
 	for (int i = l;i<=r; ++i)
 	{
 		if(i%d==0)
 			cnt++;
 	}
 	cout<<cnt;
	return 0;
	
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
}

signed main() {
    boost;
    solve();
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    uint64_t a, b, x;
    std::cin >> a >> b >> x;
    uint64_t top = b / x * x;
    uint64_t bot;
    if ((a % x) != 0) bot = a / x * x + x;
    else bot = a/ x * x;
    uint64_t ans = (top - bot) / x + 1;
    if (top < bot) ans = 0;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 384
import numpy as np

n, T = map(int, input().split())
c = np.zeros(n)
t = np.zeros(n)
for i in range(n):
    c_tmp, t_tmp = map(int, input().split())
    c[i] = (c_tmp)
    t[i] = (t_tmp)

tmp = c[t <= T]

if len(tmp) == 0:
    print("TLE")
else:
    print(int(min(tmp)))


Measured memory_bytes: 13336
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int n, k;
string s;

int main(){
    INIT;
    cin >> n >> k;
    cin >> s;
    if(s[k-1] == 'A') s[k-1] = 'a';
    if(s[k-1] == 'B') s[k-1] = 'b';
    if(s[k-1] == 'C') s[k-1] = 'c';
    cout << s << "\n";
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while(a > 0 && b > 0){
		
		c -= b;
		if(c <= 0) break;
		a -= d;
	}
	if(a <= 0) printf("No");
	else printf("Yes");
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
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; }
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;}
#define all(x) x.begin(), x.end()

bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    ll N;
    cin >>N;
    vector<vector<pair<ll,ll>>> xy(N);
    
    rep(i,N){
        ll A;
        cin >> A;
        rep(j,A){
            ll x,y;
            cin >> x>>y;
            xy[i].pb(make_pair(x-1,y));
        }

    }
    ll max = 0;
    rep(bit,1<<N){
        vector<ll> S;
        vector<ll> S2;
        rep(i,N){
            if(bit&(1<<i)){
                S.pb(i);
                S2.pb(1);
            }else{
                S2.pb(0);
            }
        }
        bool flag = 0;
        rep(i,S.size()){
            rep(j,xy[S[i]].size()){
                if(xy[S[i]][j].second == 1 && S2[xy[S[i]][j].first] == 0){
                    flag =1;
                    //cout<<"A"<<endl;
                    break;
                }
                if(xy[S[i]][j].second == 0 && S2[xy[S[i]][j].first] == 1){
                    flag =1;
                    //cout<<"B"<<endl;
                    break;
                }
                
            }
            if(flag) break;
            if(i == S.size()-1){
                if(S.size() > max){
                    max = S.size();
                }
                
            }
        }
        
    }
    cout << max << endl;


    return 0;
    

}

Measured memory_bytes: 3640
#include<iostream>
#include<queue>

#include<vector>
#include<utility>

using namespace std;

#define MAX 10000
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 1<<21

int n;
vector<pair<int, int> > adj[MAX]; 
int color[MAX], d[MAX];

void dijkstra(){
  priority_queue<pair<int,int> > PQ;
  
  for(int i=0;i<n;i++){
    color[i] = WHITE;
    d[i] = INFTY;
  }

  d[0] = 0;
  color[0] = GRAY;
  PQ.push(make_pair(d[0],0));

  while( !PQ.empty() ){
    pair<int, int> present = PQ.top();
    PQ.pop();

    int u = present.second;
    color[u] = BLACK;

    for(int j=0;j<adj[u].size();j++){
      int v = adj[u][j].first;
      if(color[v] != BLACK && d[v] > d[u] + adj[u][j].second ){
        d[v] = d[u] + adj[u][j].second;
        color[v] = GRAY;
        PQ.push(make_pair(-1*d[v], v));
      }   
    }
  }

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

}

int main(void){
  cin >> n;
  int u,k;
  int s,t;
  for(int i=0;i<n;i++){
    cin >> u >> k;
    for(int j=0;j<k;j++){
      cin >> s >> t;
      adj[u].push_back(make_pair(s, t));
    }
  }

  dijkstra();

  return 0;
}



Measured memory_bytes: 7972
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int flag=0;
    int number[100005];
    for(int i=1;i<=n;i++)
        cin>>number[i];
        sort(number+1,number+n+1);
     int sum=0;
     for(int i=2;i<=n;i++)
        if(number[i]==number[i-1]) number[i]=number[i-1]=0;
        for(int i=1;i<=n;i++)
            if(number[i]) sum++;
        cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 640
n = int(input())

al1 = list(map(int, input().split(' ')))
al2 = list(map(int, input().split(' ')))

s1 = [al1[0]]

for i in range(1, n):
    s1.append(s1[i - 1] + al1[i])

s2 = [sum(al2)]
for i in range(1, n):
    s2.append(s2[i - 1] - al2[i - 1])

mx = -1
for j in range(n):
    tmp = s1[j] + s2[j]
    if mx < tmp:
        mx = tmp

print(mx)


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

#define pi 3.141592654
#define fix(n) cout << fixed << setprecision(n)

#define rep(i,a,b) for(int i=a;i<b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)

#define ll  long long
#define ull unsigned long long

#define mp make_pair
#define pb push_back
#define fi first
#define se second

#define vi      vector<int>
#define pii     pair<int,int>
#define piii    pair<pair<int,int>,int>
#define all(v)  v.begin(), v.end()

int mod = 1000000007;
const int N = 1000005;

// gcd
ll gcd(ll a , ll b)
{
    if ( b == 0)
    return a;
    return gcd( b, a % b);
}
bool pr[N];
void prime()
{
	pr[0] = pr[1] = true;
	for ( int i = 2; i * i < N; i++)
	{
		if ( pr[i] == false)
		for ( int j = i * i; j < N; j+= i)
			pr[j] = true;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	int a[n+1], b[n+1], c[n+1];
	rep(i,0,n)
	cin >> a[i];
	rep(i,0,n)
	cin >> b[i];
	rep(i,0,n)
	cin >> c[i];
	sort(a,a+n);
	sort(b,b+n);
	sort(c,c+n);
	ll ans = 0;
	for ( int i = 0; i < n; i++)
	{
		int x = (lower_bound(a,a+n,b[i]) - a);
		int y = n - (upper_bound(c,c+n,b[i]) - c) ;
		ll p = x;
		p *= y;
		ans += p;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 1408
#define _GLIBCXX_DEBUG
#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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  vector<tuple<string,int,int> > v(n);
  rep(i,n){
    string a;
    int b;
    cin >> a >> b;
    v[i]=make_tuple(a,-b,i+1);
  }
  sort(all(v));
  vector<int> ans(n);
  rep(i,n){
    string a;
    int b,c;
    tie(a,b,c)=v[i];
    ans[i]=c;
  }
  rep(i,n){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
typedef long long LL;
const LL mod = 1e9 + 7;
const int N = 3e5 + 5;

int n;
LL k, a[N];
LL l, r;

bool Check(LL s) {
	LL res = 0;
	rep(i, 1, n)
	    res += (a[i] + s - 1)/s - 1;
	return res <= k;
}

int main() {
	cin>>n>>k;
	rep(i, 1, n) 
		cin>>a[i];
	l = 1, r = 1e9;
	while(l < r) {
		LL mid = (r + l)/2;
		if(Check(mid)) r = mid;
		else l = mid + 1;
	}
	cout<<l<<endl;
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ret return
using namespace std;
int main() {
	string res("");
	ll in;
	cin>>in;
	while(in>0) {
		in--;;
		res+=(char)('a'+in%26);
		in=in/26;
		
	}
	reverse(res.begin(),res.end());
	cout<<res<<endl;
	ret 0;
}





Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  A=A%B;
  bool ans=false;
  for (int i=0;i<B;i++){
    int x=A*i;
    if (x%B==C){
      ans=true;
      break;
    }
  }
  if (ans){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef ONLINE_JUDGE
#define debug(x) {}
#else
#define debug(x) { cerr << #x << " = " << x << endl; }
#endif
int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int x = n / 1.08 - 50;
  while( int(1.08 * x) < n) x++;
  if( int(1.08 * x) == n)
  	cout<<x<<'\n';
  else
  	cout<<":(\n";
  
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

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

	int n;
  cin >> n;
  cout << n / 2 + (n % 2);
}

Measured memory_bytes: 256
// ACPC_pnaanty_ike
// coder : naan

#include<bits/stdc++.h>

int main(){
    using namespace std;
    long X, A, B;
    unsigned long N;
    cin >> X >> A >> B >> N;
    for(unsigned long i = 0; i < N; ++i){
        string s;
        cin >> s;
        if(s == "nobiro"){
            X += A;
        }else if(s == "tidime"){
            X += B;
        }else{
            X = 0;
        }
        X = max(0L, X);
    }
    cout << X << endl;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,i,mn,mx,a[101],opmx,opmn;
int main(){
	mn=1e9;mx=-1e9;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
      scanf("%d",&a[i]);
      if(a[i]<mn)mn=a[i],opmn=i;
      if(a[i]>mx)mx=a[i],opmx=i;
}
    printf("%d\n",n*2-2);
   if(abs(mx)>=abs(mn)){
   	printf("%d %d\n",opmx,n);
   	printf("%d %d\n",opmx,n);
   	for(i=2;i<n;i++){
   		printf("%d %d\n",n,i);
   		printf("%d %d\n",n,n);
	   }
   }
    else{
    	printf("%d %d\n",opmn,1);
    	printf("%d %d\n",opmn,1);
    	for(i=n-1;i>1;i--){
    		printf("%d %d\n",1,i);
    		printf("%d %d\n",1,1);
		}
	}
}

Measured memory_bytes: 256
import bisect
N = int(input())
S = [input() for _ in range(N)]
T = input() 
best = []
worse = []
for s in S:
    best.append(s.replace('?', 'z'))
    worse.append(s.replace('?', 'a'))
ans=[]
best.sort()
worse.sort()
for i in range(bisect.bisect_left(best,T)+1,bisect.bisect_right(worse,T)+2):
    ans.append(i)
print(*ans)
           

Measured memory_bytes: 5364
import sys
sys.setrecursionlimit(100000000)
input = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N,K = map(int,input().split())
    if N%K == 0:
        print(0)
    else:
        print(1)    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
# define ll long long int
# define Mod 1000000007
using namespace std;

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

int main(){
	fast();
	ll n;
	cin>>n;
	double a[n],ans=0;
	for(ll i=0;i<n;i++){
		cin>>a[i];
		ans+=(double)(1/a[i]);
	}
	cout<<fixed<<setprecision(10)<<(double)(1/ans);	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N, M;
  char a[51][51], b[51][51];
  int res=0;
  cin >> N >> M;

  rep(i,N) cin >> a[i];
  rep(i,M) cin >> b[i];

  FOR(j,0,N-M){
    FOR(i,0,N-M){
      bool match=true;
      //cout << "-------" << endl;                                              
      rep(m,M){
        rep(n,M){
          if(a[i+n][j+m] != b[n][m])match=false;
          //break;                                                              
          //cout <<  a[i+n][j+m];                                               
        }
        //cout << endl;                                                         
        //if(!match) break;                                                     
      }
      if(match) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#  define DEBUG(x) cerr << "DBG: " <<  x << endl
#else
#  define DEBUG(x) do {} while (0)
#endif
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
#define each(x, v) for (auto &x : v)
#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define mem(a, val) memset(a, val, sizeof(a))
#define rep(i, N) for (int i = 0; i < N; i++)
#define repr(i, N) for (int i = (N)-1; i >= 0; i--)
#define rep1(i, N) for (int i = 1; i <= (N); i++)
#define repr1(i, N) for (int i = (N); (i) > 0; i--)
using ii = pair<int, int>;
using ll = long long;
const int inf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f3fll;
template<typename T> T abs (T x) { return x < 0 ? -x : x; }
template<typename T> T gcd (T a, T b) { return a ? gcd (b % a, a) : b; }
template<typename T> void max_self(T &a, T b) {  a = max(a, b); }
template<typename T> void min_self(T &a, T b) {  a = min(a, b); }
vector< vector<int> > adj;
vector<int>dp;
vector<int>deg;
vector<int>vstd;
void dfs(int id) {
  assert(!vstd[id]);
  vstd[id] = 1;
  each(u, adj[id]) {
    max_self(dp[u], dp[id] + 1);
    deg[u]--;
    if(deg[u] == 0)dfs(u);
  }
}

void solve(int tc) {
  int n, m, u, v;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  adj.resize(n);
  dp.resize(n, 0);
  vstd.resize(n, 0);
  deg.resize(n, 0);
  rep(i, m){
    cin >> u >> v;
    --u;
    --v;
    adj[u].pb(v);
    deg[v]++;
  }
  rep(i, n)if(!vstd[i] && deg[i] == 0)dfs(i);
  int ans = 0;
  rep(i, n)max_self(ans, dp[i]);
  cout << ans << endl;
}

int main() {
  int tc = 1;
  // scanf("%d", &tc);
  for(int i = 1; i <= tc; ++i)solve(i);
  return 0;
}

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

using namespace std;

long N, slime[1<<9], dp[1<<9][1<<9], imos[1<<9];

long rec(int l = 0, int r = N)
{
	if (~dp[l][r]) return dp[l][r];
	if (l+1==r) return dp[l][r] = slime[l];
	long res = LONG_MAX;
	for (int p = l+1; p < r; p++)
	{
		res = min(res, rec(l, p)+rec(p, r)+imos[r]-imos[l]);
	}
	return dp[l][r] = res;
}

void solve()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> slime[i];
		imos[i+1] = imos[i] + slime[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << rec()-imos[N] << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 2304
require 'prime'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
x=gsmi.sort
putsend 0 if n==1
min=x[0]
max=x[-1]

mini=10**9
min.upto max do |i|
  sum=0
  x.each do |j|
    c=(j-i)**2
    sum+=c
  end
  mini=sum if mini>sum
end

puts mini

Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

int main(){
    ll N,W; cin>>N>>W;

    vector<ll> w(N);
    vector<ll> v(N);

    rep(i,N) cin>>w[i]>>v[i];

    vector<vector<ll>> dp(101,vector<ll>(100001,INF));

    dp[0][0]=0;
    for (int i=0;i<N;i++) {
        for (int j=0;j<100001;j++) {
            if (j-v[i]>=0) dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);

            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        }
    }

    ll ans=0;
    for(int j=0;j<100001;j++) {
        if(dp[N][j]<=W) ans=j;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 80256
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int N = Integer.parseInt(in.readLine());
		String[] S = in.readLine().split(" ");
		Set<String> set = new HashSet<>();
		for (int i = 0; i < N; ++i) {
			set.add(S[i]);
		}
		if (set.size() == 3) {
			System.out.println("Three");
		} else {
			System.out.println("Four");
		}
	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 21204
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    // http://abc045.contest.atcoder.jp/tasks/abc045_a
    public class Abc045_a
    {
#if !Development
		public static void Main(string[] args)
		{
			Abc045_a.Solve(args);
		}
#endif

        public static void Solve(string[] args)
        {
            var a = ReadLineInt()[0];
            var b = ReadLineInt()[0];
            var h = ReadLineInt()[0];

            var result =((a + b) * h) / 2;


            Console.WriteLine(result.ToString());
        }

        public static List<string> ReadLineString() { return Console.ReadLine().Split(' ').ToList(); }
        public static List<int> ReadLineInt() { return Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToList(); }
    }
}

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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int64_t pow10(int n) {
    int64_t p = 1;
    for (int i = 0; i < n; ++i) {
        p *= 10;
    }
    return p;
}

tuple<int64_t, int64_t> nlteq_elems(const vector<int64_t>& as, int64_t M) {
    int64_t nlt = 0, neq = 0;
    for (int i = 1; i < as.size(); ++i) {
        int64_t ai = as[i];
        debug(ai);
        const auto end = as.begin() + i;
        if (ai == 0) { 
            if (M > 0) {
                nlt += i; 
            }
            if (M == 0) {
                neq += i;
            }
        } else if (ai > 0) {
            int64_t mai = (M % ai == 0) ? M / ai : 
                          (M > 0) ? M / ai + 1 :
                          M / ai;
            debug(mai);
            nlt += distance(as.begin(), lower_bound(as.begin(), end, mai));
            if (M % ai == 0) {
                neq += distance(lower_bound(as.begin(), end, M / ai), upper_bound(as.begin(), end, M / ai));
            }
        } else {
            int64_t mai = (M % ai == 0) ? M / ai : 
                          (M > 0) ? M / ai - 1 :
                          M / ai;
            debug(mai);
            nlt += i - distance(as.begin(), upper_bound(as.begin(), end, mai));
            if (M % ai == 0) {
                neq += distance(lower_bound(as.begin(), end, M / ai), upper_bound(as.begin(), end, M / ai));
            }
        }
        debug(nlt);
    }
    return make_tuple(nlt, neq);
}

int main() {
    int64_t n, k;
    cin >> n >> k;
    vector<int64_t> as;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        as.push_back(a);
    }
    sort(as.begin(), as.end());
    // ans \in [l, h)
    int64_t mxp = pow10(18);
    int64_t mnp = -pow10(18);
    debug(mxp); debug(mnp);

    int64_t l = mnp, h = mxp + 1;
    while (h - l >= 2) {
        int64_t m = (l + h) / 2;
        debug(l); debug(h); debug(m);
        int64_t nlt, neq;
        tie(nlt, neq) = nlteq_elems(as, m);
        debug(nlt); debug(neq);
        if (nlt < k && k <= nlt + neq) { cout << m << endl; break; }
        else if (k <= nlt) { h = m; }
        else if (nlt + neq < k) { l = m; }
        else { assert(false); }
    }
}

Measured memory_bytes: 2420
#include <assert.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#ifndef __DEBUG__
    #define debug NULL
#else
    #define debug printf("%s %d\n", __FUNCTION__, __LINE__);
#endif
const int inf = 2147483647;
const int maxn = 1e5 + 10;

int a[maxn];
int main(int argc, char **argv) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int ans = 0;
    for (int i = 1; i < n; i++) 
        if (a[i] == i) {
            ans++;
            swap(a[i], a[i + 1]);
        }
    if (a[n] == n) ans++;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

int main(void){
  int a;
  string s;
  cin >> a >> s;
  if(a < 3200) s = "red";
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stack>
#include<unordered_set>
#include<algorithm>

#define N 1000

int n, u, k, v;
int G[N][N];
std::stack<int> S;
std::unordered_set<int> hasVisited;
int count, d[N], f[N];

void visit(int x) {
    hasVisited.insert(x);
    d[x] = count++;
    for(int i = 1; i <= n; i++) {
        if(G[x][i] != 0 && hasVisited.find(i) == hasVisited.end()) {
            visit(i);
        }
    }
    f[x] = count++;
}

int main() {

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            G[i][j] = 0;
        }
    }
    std::cin >> n;
    for(int i = 0; i < n; i++) {
        std::cin >> u >> k;
        for(int j = 0; j < k; j++) {
            std::cin >> v;
            G[u][v] = 1;
        }
    }

    count = 1;
    for(int i = 0 ; i < N; i++) {
        d[i] = 0;
        f[i] = 0;
    }

    for(int i = 1; i <= n; i++) {
        if(hasVisited.find(i) == hasVisited.end())
            visit(i);
    }
    for(int i = 1; i <= n; i++) {
        printf("%i %i %i\n", i, d[i], f[i]);
    }

    return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    vector<int>ans;
    vector<int>rans;
    for (int i = 0; i < n; ++i) {
        int c;cin >>c;
        if(i%2==0){
            ans.push_back(c);
        }
        else {
            rans.push_back(c);
        }
    }
    if(n%2==1){
        reverse(all(ans));
        for (int i = 0; i < ans.size(); ++i) {
            cout <<ans[i]<<endl;
        }
        for (int i = 0; i < rans.size(); ++i) {
            cout <<rans[i]<<endl;
        }
    }
    else {
        swap(ans,rans);
        reverse(all(ans));
        for (int i = 0; i < ans.size(); ++i) {
            cout <<ans[i]<<endl;
        }
        for (int i = 0; i < rans.size(); ++i) {
            cout <<rans[i]<<endl;
        }
    }
    return 0;
}


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

using namespace std;

const int MOD = 1e9+7;

long power(int e, int x)
{
	if (x == 0) return 1;
	long res = (x&1 ? e : 1);
	long tmp = power(e, x>>1);
	return (res *= tmp * tmp % MOD) %= MOD;
}

void solve()
{
	int N, X, Y, Z;
	cin >> N >> X >> Y >> Z;
	int ans = 0, S = X + Y + Z, mask = (1<<S)-1;
	vector<int> dp(1<<S);
	dp[0] = 1;
	for (int i = 0; i < N; i++)
	{
		vector<int> nx(1<<S);
		for (int bit = 0; bit < 1<<S; bit++)
		{
			if (!dp[bit]) continue;
			for (int a = 1; a <= 10; a++)
			{
				int nxtbit = (((bit<<1)|1)<<(a-1))&mask;
				if (nxtbit>>(Z-1)&1 && nxtbit>>(Z+Y-1)&1 && nxtbit>>(S-1)&1)
				{
					ans += dp[bit] * power(10, N-i-1) % MOD;
					ans %= MOD;
					//cout << bitset<17>(bit) << ' ' << bitset<17>(nxtbit) << ' ' << a << ' ' << dp[bit] << endl;
				}
				else
				{
					nx[nxtbit] += dp[bit];
					nx[nxtbit] %= MOD;
				}
			}
		}
		swap(dp, nx);
	}

	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){

    //すべてのxorをとる
    int N; cin>>N;
    vec_int a(N);
    rep(i,N)cin>>a.at(i);

    bitset<32> tot(0);

    rep(i,N){
        bitset<32> temp(a.at(i));

        for(int j=0;j<32;j++){
            if((tot[j]+temp[j])%2==0){
                tot[j] = 0;
            }else{
                tot[j] = 1;
            }
        }
    }

    rep(i,N){
        bitset<32> temp(a.at(i));
        bitset<32> out(0);

        for(int j=0;j<32;j++){
            if((tot[j]+temp[j])%2==0){
                out[j] = 0;
            }else{
                out[j] = 1;
            }
        }
        if(i==N-1){
        cout<<out.to_ulong()<<endl;
        }else{
        cout<<out.to_ulong()<<" ";
        }

    }



    return 0;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int q, prime[100010], coun[100010];
bool is_prime[100010], ls_prime[100010];

int main(){
	int l;
	cin >> l;
	q = 100000;
	int p = 0;
	for(int i = 0;i <= q;i++){
		is_prime[i] = true;
	}
	is_prime[0] = false;
	is_prime[1] = false;
	for(int i = 2;i <= q;i++){
		if(is_prime[i]){
			prime[p++] = i;
			for(int j = 2 * i;j <=q;j += i){
				is_prime[j] = false;
			}
		}
	}
	for(int i = 1;i <= 100000;i++){
		if(is_prime[i]&&is_prime[(i+1)/2])ls_prime[i]=true;
	}

	for(int i = 1;i <= q;i++){
		coun[i] = coun[i-1];
		if(ls_prime[i])coun[i]++; 
	}
	for(int i = 0;i < l;i++){
		int f, g;
		cin >> f >> g;
		cout << coun[g]-coun[f-1] << endl; 
	}
	
	return 0;
}

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

using namespace std;

int main(int argc, char *argv[])
{
	string s, target = "CF";
	getline(cin, s);
	int len = s.size(), point = 0;
	for (int i = 0; i < len; ++i)
		if (s[i] == target[point])
		{
			++point;
			if (point == 2)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	cout << "No" << endl;
	return 0;
}

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

#define endl '\n'

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

    set<int> s;
    for (int i=0; i<3; i++){
        int x; cin >> x;
        s.insert(x);
    }
    if (s.size() == 2) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
//#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int last[1000005],fen[500005],n,tab[500005],ans[500005];
void update(int idx,int val){
    for (int i = idx; i <= n; i+=(i&(-i)))
        fen[i]+=val;
}
int get(int idx){
    int ans=0;
    for (int i = idx; i >= 1; i-=(i&(-i)))
        ans+=fen[i];
    return ans;
}
int sum(int a,int b){
    return get(b)-((a==1)?0:get(a-1));
}
int32_t main(){
    boost;
    int q,idx=0;
    cin>>n>>q;
    for (int i = 1; i <= n; ++i)cin>>tab[i];
    vector<pair<ii,int> >  qs(q);
    for (int i = 0; i < q; ++i)
        cin>>qs[i].fi.se>>qs[i].fi.fi,qs[i].se=i;
    sort(all(qs));
    for (int i = 1; i <= n; ++i)
    {
        if(last[tab[i]])update(last[tab[i]],-1);
        last[tab[i]]=i,update(i,1);
        while((idx<q) && (qs[idx].fi.fi==i)){
            ans[qs[idx].se]=sum(qs[idx].fi.se,qs[idx].fi.fi);
            idx++;
        }
    }
    for (int i = 0; i < q; ++i)cout<<ans[i]<<"\n";
    return 0;
}
//long long
//array bounds
//special cases
//binary search

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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 U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::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==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 X[2], A[2], C;
	cin >> X[0] >> X[1] >> A[0] >> A[1] >> C;
	vector<int64> p[2];
	priority_queue<int64, vector<int64>, greater<int64>> pq[2];
	REP(i, 2) {
	  p[i].resize(A[i]);
	  REP(j, A[i]) {
	    cin >> p[i][j];
	    pq[i].push(p[i][j]);
	    if (pq[i].size() > X[i]) pq[i].pop();
	  }
	}
	vector<int64> r(C);
	REP(i, C) cin >> r[i];
	sort(all(r), greater<int64>());
	REP(i, C) {
	  if (r[i] - pq[0].top() >= r[i] - pq[1].top()) {
	    if (r[i] - pq[0].top() <= 0) continue;
	    pq[0].pop();
	    pq[0].push(r[i]);
	  } else {
	    if (r[i] - pq[1].top() <= 0) continue;
      pq[1].pop();
      pq[1].push(r[i]);
    }
	}
	int64 res = 0;
	REP(i, 2) {
	  while (pq[i].size()) {
	    res += pq[i].top();
	    pq[i].pop();
	  }
	}
	cout << res << endl;
}


Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A<= C&& C<= B) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    for( int i = 0; i < s.size() - 1; ++i ) {
        if( s[i] == s[i + 1] ) {
            cout << i + 1 << " " << i + 2 << endl;
            return 0;

        }

    }

    for( int i = 1; i < s.size() - 1; ++i ) {
        if( s[i - 1] == s[i] || s[i - 1] == s[i + 1] || s[i] == s[i + 1] ) {
            cout << i << " " << i + 2 << endl;
            return 0;

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



Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 300010
using namespace std;
int num[N],val[64];
int l[32][N],r[32][N];
int f[1<<22],g[1<<22];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&num[i]);
	int tot=0,res=m;
	while(res)
	{
		val[tot++]=res>>1;
		res>>=1;
	}
	val[tot]=m;
	for(int i=0;i<=tot;i++)
	{
		l[i][1]=1;
		for(int j=2;j<=n;j++)
		{
			if(num[j]-num[j-1]<=val[i]) l[i][j]=l[i][j-1];
			else l[i][j]=j;
		}
	}
	int sum=0;
	for(int i=0;i<=tot;i++)
	{
		r[i][n]=n;
		for(int j=n-1;j>=1;j--)
		{
			if(num[j+1]-num[j]<=val[i]) r[i][j]=r[i][j+1];
			else
			{
				r[i][j]=j;
				if(i==tot) sum++;
			}
		}
	}
	if(sum>tot){for(int i=1;i<=n;i++)puts("Impossible");return 0;}
	int p=1<<tot;
    for(int s=0;s<p;s++) g[s]=n+1;
	for(int s=0;s<p;s++)
        for(int i=0;i<=tot;i++)
            if(!((s>>i)&1))
            {
                f[s|(1<<i)]=max(f[s|(1<<i)],r[i][f[s]+1]);
                g[s|(1<<i)]=min(g[s|(1<<i)],l[i][g[s]-1]);
			}
	for(int i=1;i<=n;i=r[tot][i]+1)
    {
        bool ok=false;
        for(int s=0;s<p && !ok;s++) if(f[s]>=i-1 && g[(p-1)-s]<=r[tot][i]+1) ok=true;
        for (int j=i;j<=r[tot][i];j++)
        {
            if(ok) puts("Possible");
            else puts("Impossible");
        }
    }
	return 0;
}


Measured memory_bytes: 57728
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,N;
  string result = "No";
  vector<vector<int>> data(3, vector<int>(3));
  vector<vector<bool>> booldata(3, vector<bool>(3,false));
  
  // 入力 (2重ループを用いる)
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);
    }
  }
  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> B;
  	for (int i = 0; i < 3; i++) {
    	for (int j = 0; j < 3; j++) {
      		if(B == data.at(i).at(j)){
            	booldata.at(i).at(j) = true;
            }
    	}
 	 }
  }
  if(booldata.at(0).at(0) &&booldata.at(0).at(1) && booldata.at(0).at(2)){
  	result = "Yes";
  }else if(booldata.at(1).at(0) &&booldata.at(1).at(1) && booldata.at(1).at(2)){
  	result = "Yes";
  }else if(booldata.at(2).at(0) &&booldata.at(2).at(1) && booldata.at(2).at(2)){
  	result = "Yes";
  }else if(booldata.at(0).at(0) &&booldata.at(1).at(0) && booldata.at(2).at(0)){
  	result = "Yes";
  }else if(booldata.at(0).at(1) &&booldata.at(1).at(1) && booldata.at(2).at(1)){
  	result = "Yes";
  }else if(booldata.at(0).at(2) &&booldata.at(1).at(2) && booldata.at(2).at(2)){
  	result = "Yes";
  }else if(booldata.at(0).at(0) &&booldata.at(1).at(1) && booldata.at(2).at(2)){
  	result = "Yes";
  }else if(booldata.at(0).at(2) &&booldata.at(1).at(1) && booldata.at(2).at(0)){
  	result = "Yes";
  }
  
  cout << result << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

#[allow(dead_code)]
fn solve_naive(N: usize, X: i64, M: i64) -> i64 {
    let mut ans: i64 = X;

    let mut prev = X;
    for _i in 2..=N {
        let current = (prev * prev) % M;
        ans += current;
        prev = current;
    }

    return ans;
}

fn main() {
    input! {
        N: usize,
        X: i64,
        M: i64,
    }

    // rests[i] = i * i % M;
    // let mut rests = vec![0i64; M];
    // for m in 0..M {
    //     rests[m as usize] = (m * m) % M;
    // }

    // ループを探そう
    let mut loops = vec![X];
    let mut is_visited: Vec<bool> = vec![false; M as usize];
    is_visited[X as usize] = true;
    let mut prev = X;
    // dbg!(prev);

    // 最大M回
    loop {
        let current = (prev * prev) % M;

        if is_visited[current as usize] {
            // 後で使えるようにするため、ループの出発点をprevに入れておく
            prev = current;
            break;
        }

        // dbg!(current);

        loops.push(current);
        is_visited[current as usize] = true;
        prev = current;
    }

    // ループの開始点
    // dbg!(prev);

    let mut ans: i64 = 0;
    let mut rest: usize = N;

    let mut true_loops = vec![];

    // まずループ開始点に辿り着く前まで
    let mut is_in_loop = false;
    for &a2 in loops.iter() {
        if a2 == prev {
            is_in_loop = true;
        }

        if is_in_loop {
            true_loops.push(a2);
        } else {
            ans += a2;
            rest -= 1;
        }
    }

    // できるだけloop
    let loop_sum: i64 = true_loops.iter().sum();
    let n: i64 = (rest / true_loops.len()) as i64;
    ans += loop_sum * n;
    rest -= true_loops.len() * n as usize;

    // 残りやる
    for i in 0..rest {
        let a2 = true_loops[i];
        ans += a2;
    }

    // let mut prev = X;
    // for _i in 2..=N {
    //     let current = (prev * prev) % M;
    //     ans += current;
    //     prev = current;
    // }

    println!("{}", ans);
}


Measured memory_bytes: 3000
#include <iostream>

using namespace std;

int main() {
    int a, b, c;

    cin >> a >> b >> c;

    if ((a == 5 && b == 7 && c == 5) ||
        (a == 5 && b == 5 && c == 7) ||
        (a == 7 && b == 5 && c == 5)) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }

    return 0;
}

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

const int B = 40;

const ll INF = 1e18;

int main()
{
	int N;
	ll K;
	cin >> N >> K;
	vector<int> cnt(B);
	for(int i = 0 ;i < N;i++){
		ll a;
		cin >> a;
		for(ll j = 0;j < B;j++) if(a & (1LL << j)) {
			++cnt[j];
		}
	}
	vector<vector<ll>> dp(B + 1, vector<ll>(2, -INF));
	dp[0][0] = 0;
	for(ll i = B - 1;i >= 0;i--){
		int id = B - 1 - i;
		int v = (K >> i) & 1;
		for(int b = 0;b < 2;b++){
			int m = b ? 1 : v;
			for(int d = 0;d <= m;d++){
				int c = b || (d < m);
				dp[id + 1][c] = max(dp[id + 1][c], dp[id][b] + (d ? ((ll)(N - cnt[i]) << i) : ((ll)cnt[i] << i)));
			}
		}
	}
	cout << max(dp[B][0], dp[B][1]) << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque


def find_shortest_cycle(G, s):
    dq = deque()
    N = len(G)
    INF = float('inf')
    dist = [INF] * N
    dist[s] = 0
    parent = [-1] * N

    ans_last = None # sからループを探して見つかった時の、ループの最後の頂点番号
    dq.append(s)
    # BFSでループを見つける
    while dq and ans_last is None:
        v = dq.popleft()
        d = dist[v]
        for n in G[v]:
            # 頂点vからいける頂点の中に開始点があったら、ループである
            if dist[n] == 0:
                ans_last = v
                parent[n] = v
                break
            # まだ探索していない頂点なら次の探索候補にする
            elif dist[n] == INF:
                dist[n] = d + 1
                parent[n] = v
                dq.append(n)

    # ループが見つかった場合
    if ans_last:
        # ループの最後の頂点から、元の頂点をたどり、そのルートを逆にする
        g = ans_last
        route = [g]
        while g != s:
            g = parent[g]
            route.append(g)
        return list(reversed(route))
    
    # 見つからなかった場合はNoneを返す
    return None

def main():
    N, M, *A = map(int, read().split())

    G = [[] for i in range(N+1)]
    for a, b in zip(A[::2], A[1::2]):
        G[a].append(b)

    # すべての頂点の入次数が 1、出次数が 1 であるような G の誘導部分グラフ
    # [すべての頂点の入次数が 1、出次数が 1 のグラフ] -> ループ

    # 有向グラフ G=(V,E) に対し、次のような条件を満たす有向グラフ G′=(V′,E′) を G の誘導部分グラフと呼ぶ。
    # V′ は V の (空でない) 部分集合である。
    # E′ は、E の辺であって両端点がともに V′ に含まれるものすべてを含む集合である。

    # -> ループでも、ショートカットできるようなループはだめ

    # 例: 1 -> 2 -> 3 -> 4 -> 5
    #     ^    |         ^    |
    #     |    ----------|    |
    #     ---------------------
    # V' = {1, 2, 3, 4, 5} としてしまうと、
    # E' = {(1->2), (2->3), (3->4), (2->4), (4->5), (5->1)}
    # となってしまい、この誘導部分グラフG'=(V', E')において、
    # 頂点2の出次数が2になってしまう。（頂点4の入次数も2になってしまう）
    # V' = {1, 2, 4, 5} とすれば、
    # E' = {(1->2), (2->4), (4->5), (5->1)}
    # となり、すべての頂点の入次数が 1、出次数が 1 となる
    
    # つまり、ショートカットできない最短のループを1つでも見つければよい
    
    min_route = None
    for s in range(1, N+1):
        # 各頂点を開始点にしてループを探す
        route = find_shortest_cycle(G, s)
        # ループが複数ある場合、短いほうを採用
        if route:
            if min_route is None or len(route) < len(min_route):
                min_route = route
    
    if min_route:
        print(len(min_route), *min_route, sep='\n')
    else:
        print(-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9736