akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<ll,ll> pi;
#define inf 1000000000000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair

int a, b, c;

int main(){

cin >> a >> b >> c;
if(a+b==c || b+c==a || a+c==b)cout << "Yes";
else cout << "No";



return 0;}


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

typedef long long ll;
using namespace std;
int main()
{
  ll n,a[110];
  ll min=10000000,max=0;
  cin>>n;
  rep(i,n){
    cin>>a[i];
    if(max<a[i])max=a[i];
    if(min>a[i])min=a[i];
  }

  cout<<max-min<<endl;
  return 0;
}


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

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

  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll prod1=a*c;
  ll prod2=a*d;
  ll prod3=b*c;
  ll prod4=b*d;
  cout<<max(max(max(prod1,prod2),prod3),prod4)<<"\n";
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef complex<int> ci;
typedef complex<double> cd;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ge(a, b) get<(b)>((a))
#define SZ(x) (x).size()
#define ft front()
#define bk back()
#define ins insert
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define FORI(a, b) for (auto(a) = (b).begin(); (a) != (b).end(); ++(a))
#define ROFI(a, b) for (auto(a) = (b).rbegin(); (a) != (b).rend(); ++(a))
#define CEIL(a, b) ((a) + (b)-1) / (b)
const int xd[4] = {0, 1, 0, -1}, yd[4] = {1, 0, -1, 0};
template <typename t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <typename t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}

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

    int k, n;
    cin >> k >> n;
    vi a(n);
    F0R (i, n)
        cin >> a[i];
    vi d(n);
    F0R (i, n - 1)
        d[i] = a[i + 1] - a[i];
    d[n - 1] = k - a[n - 1] + a[0];
    int m = *max_element(ALL(d));
    cout << k - m << endl;

    return 0;
}



Measured memory_bytes: 1792
///
// File:  1148.cpp
// Author: ymiyamoto
//
// Created on Fri Nov 17 00:20:41 2017
//

#include <cstdint>
#include <iostream>
#include <stack>
#include <vector>

using namespace std;

int32_t main()
{
  while (true) {
    uint32_t N, M;
    cin >> N >> M;
    if (N == 0 && M == 0) break;

    vector<stack<uint32_t>> stacks(M + 1);
    vector<vector<pair<uint32_t, uint32_t>>> used(M + 1);
    uint32_t r;
    cin >> r;
    for (uint32_t _ = 0; _ < r; _++) {
      uint32_t t, n, m, s;
      cin >> t >> n >> m >> s;
      if (s == 0) {
        if (stacks[m].empty()) {
          cerr << t << n << m << s;
          exit(1);
        }
        uint32_t start_time = stacks[m].top();
        stacks[m].pop();
        if (stacks[m].empty()) {
          used[m].push_back({start_time, t});
        }
      } else {
        stacks[m].push(t);
      }
    }

    uint32_t q;
    cin >> q;
    for (uint32_t _ = 0; _ < q; _++) {
      uint32_t s, e, m;
      cin >> s >> e >> m;
      uint32_t count = 0;
      for (auto iter = used[m].begin(); iter < used[m].end(); iter++) {
        uint32_t start = iter->first;
        uint32_t end = iter->second;
        if (start < s && e < end) {
          count += e - s;
        } else if (start < s && s < end && end < e) {
          count += end - s;
        } else if (s < start && start < e && e < end) {
          count += e - start;
        } else if (s <= start && end <= e) {
          count += end - start;
        }
      }
      cout << count << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 9648
//#define anjn
//      Anjan Agarwala - anjn98

#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, 
                  tree_order_statistics_node_update> ordered_set;

//ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

#define PR(x) cout<<#x<<": "<<x<<"\n";
#define PR1(x,y) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"\n";
#define PR2(x,y,z) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"  |  "<<#z<<": "<<z<<"\n";
#define ED cout<<'\n';

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define endl            '\n'
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define PB              push_back
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007


const int N=3e5+99;




int32_t main() 
{
    IO


    int n; cin>>n;
    vector<pii> v(n);
    fr(n) cin>>v[i].F>>v[i].S;
    sort(v.begin(),v.end());
    map <pii,int> mp;
    
    trav(x,v) mp[x]=1;

    int ans=INT_MAX,ta=0;

    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
        {
            int x=v[j].F-v[i].F,y=v[j].S-v[i].S;
           
            map<pii,int> mm;ta=0;

            for(int k=0;k<n;k++)
            {   
                int ii=v[k].F,jj=v[k].S;
                if(mm[{ii,jj}]) continue;
                ta++;
                
                while(1)
                {
                    if( mp[{ii+x,jj+y}] )
                          mm[{ii+x,jj+y}]=1,
                            ii=ii+x,jj=jj+y;
                    else break;
                }
            }
          
            ans=min(ans,ta);
        }
    if(n==1) ans=1;
    cout<<ans<<endl;    


 }

Measured memory_bytes: 2816
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define gc getchar()
#define N 100010
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
inline int gabs(int x)
{
	return x>0?x:-x;
}
int a[N];
int main()
{
	int n=inn(),ans=0;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n+1;i++) ans+=gabs(a[i]-a[i-1]);
	for(int i=1;i<=n;i++)
		printf("%d\n",ans-gabs(a[i+1]-a[i])-gabs(a[i]-a[i-1])+gabs(a[i+1]-a[i-1]));
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
bool a[1000];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int p;
		cin>>p;
		a[p]=1;
	}
	for(int i=0;i<=100;i++)
	{
		if(!a[n-i]) 
		{
			cout<<n-i<<endl;
			return 0;
		}
		if(!a[n+i])
		{
			cout<<n+i<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int depth(int now, const vvi &g) {
  int res = 0;
  vector<int> d;
  for(int i=0;i<(int)(g[now].size());++i) {
    d.push_back(depth(g[now][i], g));
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  for(int i=0;i<(int)(d.size());++i) {
    res = max(res, d[i] + i + 1);
  }
  return res;
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vvi g(n);
  for(int i=1;i<n;++i) {
    int tmp; cin >> tmp;
    tmp--;
    g[tmp].push_back(i);
  }
  cout << depth(0, g) << endl;
}


Measured memory_bytes: 15104
import java.io.*;
import java.math.BigInteger;
import java.util.*;

 
public class Main{
	/*
	 * use Integer for sorting
	 * avoid object comparison
	 * NEVER APPEND A STRING -> APPEND char by char
	 * Always use TreeSet instead of HashSet
	 * 
	 */
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long mod = (long) (1e9+7);
	static long cf = 998244353;
    static final long MAX = (long) 1e8;
    public static List<Integer>[] edges;
    public static int[][] parent;
    public static long[] fac;
    public static int N = 400000+200;
    public static int x = 0;
    public static boolean[] visited;
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		
		 int n = sc.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;++i) a[i] = sc.nextInt();
			int brick = 0;
			for(int i=0;i<n;++i) 
				if(a[i] == brick+1) ++brick;
			
			if(n-brick > n-1) out.print(-1);
			else out.print(n-brick);
	  
		
		out.close();
	}
	
}

Measured memory_bytes: 47952
// Wed Aug 12 20:03:03 IST 2020   
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int64 ii = (int)a ; ii < (int)b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int N = 1e5+7; 
const int INF = 2e9;

struct compare{
    bool operator()(vector <int64> A, vector <int64> B){
        if(A[0] == B[0])
            return A[1] < B[1];
        return A[0] < B[0];
    }
};      
  

int tests(){ 
    int n;
    cin >> n;
    vector <int> v(n);
    for(auto &x : v)
        cin >> x;
    int ans  = 0;
    forn(i,0,n)
        forn(j,i+1,n)
            forn(k,j+1,n){
                vector <int> vec({v[i], v[j], v[k]});
                sort(all(vec));
                if(vec[0]+vec[1] > vec[2] && vec[1] != vec[0] && vec[2] != vec[1])
                { 
                    // cout << i+1 << ' ' << j+1 << ' ' << k+1 << '\n'; 
                    ans++;
                }
                // ans += ( vec[0]+vec[1] > vec[2]);
            }
    cout << ans << '\n';
    return 0;
}   
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
 
}

Measured memory_bytes: 3644
from collections import deque
N, M = map(int, input().split())  # N頂点, M個の辺

graph = [[] for _ in range(N)]
edges = []

# グラフを定義する
# あとで辺の情報を使いたいから辺を格納するリストを用意する
for i in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
    graph[b].append(a)
    edges.append((a, b))


ans = 0
# ある辺を取り除いても全頂点に到達できるかを幅優先で調べる、最後にその辺を戻してあげる
for a, b in edges:
    graph[a].remove(b)
    graph[b].remove(a)
    q = deque([0])  # 開始のノード
    flag = [False] * N
    # 幅優先で1回しか到達できない頂点を調べる（親もカウントするならちょうど二回か？）
    while len(q):
        v = q.pop()

        flag[v] = True  # 部分木の根を到達済みにする
        for e in graph[v]:  # vを根にもつノード全てに操作をする
            # graphは子のみを格納するのではなく、そのノードから出ている辺を
            # 親とか子供とか関係なく全て格納してしまうため、親の方向に
            # 対して伝播をしないようにflagで管理する
            if flag[e]:  # 頂点eがvの親であればスルー
                continue

            # この時点でeはvの子供であることが確定する
            q.append(e)

    graph[a].append(b)
    graph[b].append(a)
    if not all(flag):
        ans += 1

print(ans)


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

typedef struct{
	int w = 0;
	int b = 0;
} Grid;

int main(){
	int w, h;
	int dw[] = {1,0,-1,0};
	int dh[] = {0,1,0,-1};
	while(cin >> w >> h, w+h){
		vector<string> x(h+2);
		for(int i = 1; i <= h; ++i){
			cin >> x[i];
			x[i] = "#" + x[i] + "#";
		}
		for(int i = 0; i < w+2; ++i){
			x[0] += '#';
			x[h+1] += '#';
		}
		Grid a[h+2][w+2];
		for(int i = 0; i < h+2; ++i){
			for(int j = 0; j < w+2; ++j){
				if(x[i][j]=='#' || x[i][j]=='.') continue;
				if(x[i][j]=='W'){
					queue<pair<int,int> > q;
					q.push(make_pair(i,j));
					while(!q.empty()){
						int bh = q.front().first;
						int bw = q.front().second;
						q.pop();
						for(int dir = 0; dir < 4; ++dir){
							int nh = bh + dh[dir];
							int nw = bw + dw[dir];
							if(x[nh][nw]=='#' || x[nh][nw]=='B' || x[nh][nw]=='W') continue;
							if(a[nh][nw].w==1) continue;
							q.push(make_pair(nh,nw));
							a[nh][nw].w = 1;
						}
					}
				}else{
					queue<pair<int,int> > q;
					q.push(make_pair(i,j));
					while(!q.empty()){
						int bh = q.front().first;
						int bw = q.front().second;
						q.pop();
						for(int dir = 0; dir < 4; ++dir){
							int nh = bh + dh[dir];
							int nw = bw + dw[dir];
							if(x[nh][nw]=='#' || x[nh][nw]=='B' || x[nh][nw]=='W') continue;
							if(a[nh][nw].b==1) continue;
							q.push(make_pair(nh,nw));
							a[nh][nw].b = 1;
						}
					}
				}
			}
		}
		int ans_w = 0, ans_b = 0;
		for(int i = 1; i < h+1; ++i){
			for(int j = 1; j < w+1; ++j){
				if(a[i][j].w == 1 && a[i][j].b != 1){
					ans_w++;
				}
				if(a[i][j].w != 1 && a[i][j].b == 1){
					ans_b++;
				}
			}
		}
		// for(int i = 0; i < h+2; ++i){
		// 	for(int j = 0; j < w+2; ++j){
		// 		cout << a[i][j].b;
		// 	}
		// 	cout << endl;
		// }
		cout << ans_b << " " << ans_w << endl;

	}
	return 0;
}


Measured memory_bytes: 3180
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String str=sc.next();
		for(int i=0;i<str.length();i++){
			System.out.print(str.charAt(str.length()-1-i));
		}
		System.out.println();
	}
}

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

using namespace std;

int ans = 1e9;
int m[6];
vector<bool> market(6);

bool fill(){
	return market[0]&market[1]&market[2]&market[3]&market[4];
}

void solved(int ultEntrega){

	if(fill()){
		ans = min(ans,ultEntrega);
		return;
	}
	
	
	
	for(int i=0;i<5;i++){
		if(!market[i]){
			int val = (10-ultEntrega%10)%10 + ultEntrega;
			int val2 = val +  m[i];
			market[i] = true;
			solved(val2);
			market[i] = false;
		}
	}
	
	
} 

int main(){
	
	
	
	for(int i=0;i<5;i++){
		cin >> m[i];
	}
	
	solved(0);
	
	cout << ans << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int n;
int main(){
    cin>>n;
    vector<int> takoyaki(n);
    rep(i,n)cin>>takoyaki.at(i);
    ll ans=0;
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            else{
                ans+=takoyaki.at(i)*takoyaki.at(j);
            }
        }
    }
    cout<<ans/2<<endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		new AOJ0257().doIt();
	}
	
	class AOJ0257{
		
		String solve(String input){
			if(input.equals("1 1 0")||input.equals("0 0 1"))return "Open";
			return "Close";
		}
		
		void doIt(){
			while(in.hasNext())System.out.println(solve(in.nextLine()));
		}
	}
	
}

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

int main(){
    string str1, str2, str3;

    cin >> str1 >> str2 >> str3;

    if(str1[str1.size() - 1] == str2[0] && str2[str2.size() - 1] == str3[0]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    int n; sc(n)
    int A[n];
    REP(i, n) sc(A[i])

    int sum = 0;
    REP(i, n) sum += A[i];

    int ave = sum / n;
    if (sum % n > n / 2) ave += 1;

    int ans = 0;
    REP(i, n) ans += (A[i] - ave) * (A[i] - ave);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define um unordered_map
#define us unordered_set
#define f first
#define s second
#define pb push_back
#define MOD 998244353
#define eps 1e-9
#define INF 1000000002

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pii> piii;
const int N = 1001;


int n, m;
vector<int> adjList[N];
bool inGraph[N];
vector<int> ans;

bool check(set<int> & temp) {
    int sum = 0;
    for(int i : temp) {
        for(int j : adjList[i]) {
            if(temp.find(j) != temp.end())
                sum++;
        }
    }
    return sum == temp.size();
}

void solve(int node) {
    ans.pb(node);
    inGraph[node] = true;
    for(int ch : adjList[node]) {
        set<int> tmp;
        vector<int> bla;
        if(inGraph[ch]) {
            tmp.insert(ch);
            while(ans.back() != ch) {
                tmp.insert(ans.back());
                bla.pb(ans.back());
                ans.pop_back();
            }
            if(check(tmp)) {
                cout<<tmp.size()<<endl;
                for(int i : tmp)
                    cout<<i<<endl;
                exit(EXIT_SUCCESS);
            } else {
                while(!bla.empty())
                    ans.pb(bla.back()), bla.pop_back();
            }
        } else {
            solve(ch);
        }
    }
    inGraph[node] = false;
    ans.pop_back();
}

int main() {
    cin>>n>>m;
    for(int i =0;i<m;i++) {
        int x,y;
        cin>>x>>y;
        adjList[x].pb(y);
    }
    for(int i = 1;i<=n;i++)
        solve(i);
    cout<<-1;
    return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=200005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n,k,c;
char s[max_n];
int dp[max_n*2];
vector<int> v;
int main(){
    scanf("%d%d%d",&n,&k,&c);
    scanf(" %s",s+1);
    for(int i=n;i>=1;i--){
        dp[i]=dp[i+1];
        if(s[i]=='o')dp[i]=max(dp[i],1+dp[i+c+1]);
    }
    int pre=-1;
    for(int i=1;i<=n;i++){
        if(s[i]=='o'){
            if(pre==-1||i-pre>=c+1)v.push_back(i),pre=i;
        }
    }
    /*
    for(auto x:v)cout<<x<<' ';
    cout<<endl;
    */
    for(int i=1;i<=n;i++){
        if(s[i]=='x')continue;
        int index=lower_bound(v.begin(),v.end(),i)-v.begin()-1;
        int x=index==-1?-1000000000:v[index];
        x+=c+1;x=max(x,i+1);
        //cout<<index+1<<' '<<dp[x]<<endl;
        if(index+1+dp[x]<k)printf("%d\n",i);
    }
    
    return 0;
}

Measured memory_bytes: 3444
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;

namespace 水色コーダーに俺はなった{
    class Inonoa{

        /* ここに書け */
        static void Main(){
            long[] abck = ILongs();
            long a = abck[0];
            long b = abck[1];
            long c = abck[2];
            long k = abck[3];


            if(k < a){
                WriteLine(k);
                return;
            }else if(k < a+b){
                WriteLine(a);
                return;

            }else{
                
                WriteLine(a-(k-a-b));
                return;
            }
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 27484
#include <bits/stdc++.h>
 
using namespace std;
 
 
int n,m,cnt;
char a[1005][1005];
 
int main (){
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (a[i][j] == '.'){
				if (a[i - 1][j - 1] == '#'){
					cnt++;
				}
				if (a[i][j - 1] == '#'){
					cnt++;
				}
				if (a[i + 1][j - 1] == '#'){
					cnt++;
				}
				if (a[i - 1][j] == '#'){
					cnt++;
				}
				if (a[i + 1][j] == '#'){
					cnt++;
				}
				if (a[i - 1][j + 1] == '#'){
					cnt++;
				}
				if (a[i][j + 1] == '#'){
					cnt++;
				}
				if (a[i + 1][j + 1] == '#'){
					cnt++;
				}
				a[i][j] = cnt + '0';
				cnt = 0;	
			}
		}
	}
	for (int i = 0;i < n; i++){
		for (int j = 0; j < m; j++){
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    n, a, b = map(int, input().split())
    c = 1
    d = 1
    MOD = 10 ** 9 + 7
    for i in range(a):
        c *= n - i
        d *= i + 1
        c %= MOD
        d %= MOD

    nca = c * pow(d, MOD - 2, MOD)
    nca %= MOD

    c = 1
    d = 1
    for i in range(b):
        c *= n - i
        c %= MOD
        d *= i + 1
        d %= MOD

    ncb = c * pow(d, MOD - 2, MOD)
    ncb %= MOD
    ans = pow(2, n, MOD)
    ans -=  nca + ncb
    ans %= MOD
    print(ans-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 38640
#include <bits/stdc++.h>
#define N 200002
using namespace std;
int n,L,X[N*3];
long long ans;
stack <int> s1,s2;
int dis(int x,int y){return y>x ? y-x:L+y-x;}
long long calc(int x,int d){
    if(d==1){
        int y=s1.top();
        s1.pop();
        if(x==y)return 0;
        return dis(x,y)+calc(y,-1);
    }
    else{
        int y=s2.top();
        s2.pop();
        if(x==y)return 0;
        return dis(y,x)+calc(y,1);
    }
}
void solve(){
    for(int i=n;i;--i)s1.push(X[i]);
    for(int i=1;i<=n;++i)s2.push(X[i]);
    long long sum=calc(0,1);
    ans=max(ans,sum);
    for(int i=n+1;i<=n*3+2;++i)X[i]=X[i-n-1];
    int l=(n+1)/2+1,r=n+1+(n+1)/2;
    for(int i=n+2;i<n*2+1;++i)
        if(i&1){
            sum+=dis(X[i],X[r])-dis(X[l],X[i]);
            ans=max(ans,sum);
        }
        else{
            sum+=dis(X[i],X[r+1])-dis(X[l],X[i]);
            ans=max(ans,sum);
            ++l,++r;
        }
}
int main(){
    scanf("%d%d",&L,&n);
    for(int i=1;i<=n;++i)scanf("%d",&X[i]);
    solve();
    for(int i=1;i<=n;++i)X[i]=L-X[i];
    for(int i=1;i<=n/2;++i)swap(X[i],X[n-i+1]);
    solve();
    cout<<ans<<endl;
}


Measured memory_bytes: 5020
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AthleteProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int count = 0;

            for(int i = 0; i < n-1; i++)
            {
                int min =i;
                int j = i;
                for (; j < n; j++)
                {
                    if (array[j] < array[min])
                    {
                        min = j;
                        
                    }
                }
                if (min!=i)
                {
                    Swap(ref array[i], ref array[min]);
                    count++;
                }

            }
            for(int i = 0; i < n - 1; i++)
            {
                Console.Write("{0} ", array[i]);
            }
            Console.WriteLine(array[n-1]);
            Console.WriteLine(count);

        }

        static void Swap(ref int a, ref int b)
        {
            int tmp = a;
            a = b;
            b = tmp;
        }

    }
}

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

int main() {
  long n;
  cin >> n;
  
  vector<long> h(n);
  for(int i=0; i<n; i++){
    cin >> h.at(i);
  }
  
  long m=0;
  long c=0;
  
  for(int i=0; i<n-1; i++){
    if(h.at(i)>=h.at(i+1)){
      c++;
    }else{
      c=0;
    }
      m = max(m,c);
  }
  
  cout << m <<endl;
  return 0;
}


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

using std::pair;
using std::vector;
using std::string;

typedef long long ll;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 1 << 18;

int n;
pii s[N + 5];

void upd(pii& a, pii b) {
    if(b.fst >= a.fst) {
        chkmax(a.snd, a.fst);
        a.fst = b.fst;
        chkmax(a.snd, b.snd);
    } else {
        chkmax(a.snd, b.fst);
    }
}

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n);
    for(int i = 0; i < (1 << n); ++i) read(s[i].fst);
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < (1 << n); ++j) if(j >> i & 1) {
            upd(s[j], s[j ^ (1 << i)]);
        }
    }

    int ans = 0;
    for(int i = 1; i < (1 << n); ++i) {
        chkmax(ans, s[i].fst + s[i].snd);
        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

// PMAMP :)
// INL , IIWOIL

int main()
{
    jaldi
    int n,r;
    cin>>n>>r;
    int ans=0;
    if(n>=10) ans=r;
    else ans = r+(100*(10-n));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <unordered_map>

using namespace std;
typedef long long ll;

const ll MD = 1e9+7;
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int d;
        cin >> d;
        v.push_back(d);
    }
    sort(v.begin(), v.end());
    ll res = 1;
    for (int i = 0; i < (int)v.size(); i++) {
        res *= (v.begin()+i) - lower_bound(v.begin(), v.begin()+i, v[i]-k) + 1;
        res %= MD;
    }
    cout << res << endl;
    return 0;
}

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

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(N));
  rep(i,K)
  {
    cin >> d[i];
    rep(j, d[i])
    {
      cin >> A[i][j];
    }
  }

  vector<bool> have(N,false);
  rep(i,K) rep(j, d[i])
  {
    have[A[i][j]] = true;
  }
  
  int res = 0;
  for(int i = 1; i <= N; i++)
  {
    if(!have[i]) res++;
  }
  cout << res << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
vector<int> es[114514];

int Dfs(int v, int p) {
  int ret = 0;
  for (int u : es[v]) {
    if (u == p) continue;
    ret ^= (Dfs(u, v)+1);
  }
  return ret;
}

int main() {
  scanf("%d", &N);
  rep(i, N-1) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    es[x].eb(y);
    es[y].eb(x);
  }

  auto res = Dfs(0, 0);
  if (res != 0) puts("Alice");
  else puts("Bob");
}


Measured memory_bytes: 10752
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      int h = Integer.parseInt(lines[0]);
      int w = Integer.parseInt(lines[1]);
      boolean[][] mat = new boolean[h][w];

      String line;
      for(int y=0; y<h; y++) {
        line = in.readLine();
        for(int x=0; x<w; x++) {
          mat[y][x] = line.charAt(x) == '#' ? true : false;
        }
      }

      int[] rx = {0,0,-1,1};
      int[] ry = {-1,1,0,0};
      boolean result = true;
      boolean isPossible = false;
      for(int y=0; result && y<h; y++) {
        for(int x=0; result && x<w; x++) {
          if(mat[y][x]) {
            for(int i=0; i<4; i++) {
              if(y+ry[i] > -1 && y+ry[i] < h && x+rx[i] > -1 && x+rx[i] < w)
                if(mat[y+ry[i]][x+rx[i]]) isPossible = true;
            }
            if(isPossible) isPossible = false;
            else {
              result = false;
              // System.out.println( y + " " + x);
            }
          }
        }
      }

      String ans = result ? "Yes" : "No";
      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

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

int main() {
  string s;
  cin >> s;
  int i;
  for (i = 0; i < s.length(); i++) {
    if (!((i % 2 == 0 && s.at(i) != 'L') || (i % 2 == 1 && s.at(i) != 'R'))) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

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;}

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

const ll INF = 1e10;;

int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> h(n+k);
    rep(i,n) cin >> h[i];

    vector<ll> c(n+k,INF);
    c[0] = 0;
    rep(i,n){
        for(int j = 1; j <= k; j++){
           chmin(c[i+j],c[i]+abs(h[i]-h[i+j])); 
        }
    }
    // chmin(c[n-1], c[n-2]+abs(h[n-1]-h[n-2]));

    cout << c[n-1] << endl;

    return 0;
}

Measured memory_bytes: 1920
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N, K;
    vector<unsigned long> v;
    
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        unsigned long a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());

    unsigned long sum = 0;
    for (int i = 0; i < N - K; i++) {
        sum += v[i];
    }
    cout << sum << endl;
    return 0;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 2420
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pqueue priority_queue<ll>
#define piqueue priority_queue<ll,vll ,greater<ll>>
#define pinf LLONG_MAX
#define ninf LLONG_MIN
#define all(v) v.begin(),v.end()
#define endl '\n'
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define pi 3.1415926535897932384
using namespace std;
using namespace __gnu_pbds;

typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,
tree_order_statistics_node_update> ordered_multiset;

void pv(vector<auto> &v,ll start = 0, ll end = 0){
    if(end != v.size() - 1) end = v.size() - 1;
    for(ll i = start; i <= end; i++) cout << v[i] << " "; cout << endl;
}
void inline pp(pair<auto, auto> p) { cout << p.ff << " " << p.ss << endl; }
void inline in(vector<auto> &v, ll n) {
    v.resize(n); for(ll i = 0; i < n; i++) cin >> v[i];
}
void inline sortv(vector<auto> &v) { sort(all(v)); }
void inline sortvr(vector<auto> &v) { sort(v.rbegin(), v.rend()); }
bool inline isVowel (char c) {
    return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int solve();
int main(){
    fast();
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}
int solve(){
    string s;
    cin >> s;
    if(s == "RRR")
        cout << 3 << endl;
    else if(s == "SRR" || s == "RRS")
        cout << 2 << endl;
    else if(s == "RSS" || s == "RSR" || s == "SRS" || s == "SSR")
        cout << 1 << endl;
    else
        cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3608
main=do
  [n, k] <- map read . words <$> getLine :: IO [Integer]
  print $ solve n n k

solve :: Integer -> Integer -> Integer -> Integer

solve 0 n k = if k == 0 then (-n) else 0
solve i n k = res + solve (i-1) n k
  where
    res = (max 0 ((div n i) * (i - k))) + max 0 ((mod n i) - k + 1)


Measured memory_bytes: 11900
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

template <class T>
using vec = vector<T>;
template <class T>
using vec2 = vector<vec<T>>;
template <class T>
using vec3 = vector<vec2<T>>;

constexpr int INF = numeric_limits<int>::max();
constexpr ll INFL = numeric_limits<ll>::max();
constexpr ll MOD = 1000000007; // 10^9+7

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

constexpr ll solve(ll k)
{
    if (k % 2 == 0 || k % 5 == 0)
    {
        return -1;
    }

    ll n = 0;
    ll ret = 0;
    while (ret == 0 || n != 0)
    {
        n = n * 10 + 7;
        n %= k;
        ret++;
    }
    return ret;
}

int main()
{
    ll k = 0;
    cin >> k;
    cout << solve(k) << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 100005;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (b < c) swap(b,c);
    if (a < b) swap(a,b);
    if (b < c) swap(b,c);
    int ans = a-b;
    ans += (b-c)/2;
    if ((b-c) % 2 != 0) ans += 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pw (ll)pow 
#define MAX 1000005
using namespace std;

int main()	
{
	int x,y;
	cin >> x >> y;
	if(y<=4*x && y>=2*x && y%2==0)	cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 3596
import itertools

N, M, Q = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(Q)]
n = [i+1 for i in range(M)]
A_list = list(itertools.combinations_with_replacement(n,N))
ans = 0
for A in A_list:
    ans_ = 0
    for a, b, c, d in l:
        if A[b-1] - A[a-1] == c:
            ans_ += d
        ans = max(ans, ans_)

print(ans)

Measured memory_bytes: 84624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll n,m;cin>>n>>m;
    if(n%2==0){
        ll l=1;
        ll r=n/2;
        ll counter=0;
        while(l<r && counter<m){
            cout<<l<<' '<<r<<endl;
            l++;
            r--;
            counter++;
        }
        l=n/2+1;
        r=n-1;
        while(l<r && counter<m){
            cout<<l<<' '<<r<<endl;
            l++;
            r--;
            counter++;
        }
    }else{
        ll l=1;
        ll r=n;
        ll counter=0;
        while(l<r && counter<m){
            cout<<l<<' '<<r<<endl;
            l++;
            r--;
            counter++;
        }
    }
    
    
    return 0;
}





Measured memory_bytes: 3652
word = str(input()).lower()
Text = []
while True:
    A = list(map(str, input().split() ) )
    if A == ["END_OF_TEXT"]:
        break
    Text.append(A)

for i in range(len(Text)):
    for k in range(len(Text[i])):
        Text[i][k] = Text[i][k].lower()


count = 0
for i in range (len(Text)):
    count = count + Text[i].count(word)

print(count)



Measured memory_bytes: 5564
S = str(input())
x = len(S)

if x % 2 == 0:
  Sb = S[:x//2]
  Sa = S[x//2:]
else:
  Sb = S[:x//2]
  Sa = S[(x+1)//2:]
Sar = Sa[::-1]
cnt = 0
for i in range(x // 2):
  if Sb[i] != Sar[i]:
    cnt += 1
  else:
    pass
print(cnt)

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

int main() {
  vector<int> haiku(3);
  int f = 0; int s = 0;
  for(int i = 0; i < 3;i++){
    cin >> haiku.at(i);
    if(haiku.at(i) == 5){
      f++;
    }else if(haiku.at(i) == 7){
      s++;
    }
  }
  if(f == 2 && s == 1){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
s = input()
k = int(input())

#
#  文字数一種類
#
if len(set(s)) == 1:
    print((len(s) * k) // 2)
    exit()

#
# 先頭と末尾が異なる
#
if s[0] != s[-1]:
    cnt = 0
    bf_same = False
    tmp = 1
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            tmp += 1
        else:
            if tmp > 1:
                cnt += (tmp // 2) * k
                tmp = 1
    else:
        if tmp > 1:
            cnt += (tmp // 2) * k
        print(cnt)
    exit()

#
# 先頭と末尾が一緒
#

# 先頭のダブリ
tp = 1
tp_idx = -1
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        tp += 1
        tp_idx = i + 1
    else:
        break

# 末尾のダブリ
bt = 1
bt_idx = -1
for i in range(len(s) - 1, 0, -1):
    if s[i] == s[i - 1]:
        bt += 1
        bt_idx = i - 1
    else:
        break

# 連結部分以外のダブリ
cnt = 0
bf_same = False
tmp = 1
for i in range(tp_idx + 1, bt_idx - 1):
    if s[i] == s[i + 1]:
        tmp += 1
    else:
        if tmp > 1:
            cnt += (tmp // 2) * k
            tmp = 1
else:
    if tmp > 1:
        cnt += (tmp // 2) * k

#print(tp, bt, cnt)
#print(tp // 2 + bt // 2 + ((tp + bt) // 2) * (k - 1))
ans = cnt + tp // 2 + bt // 2 + ((tp + bt) // 2) * (k - 1)
print(ans)


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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    // 入力
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;

    // 処理
    int cnt = 0;
    rep(i, s.size()) {
        if (s[i] == '-') {
            cnt++;
        }
    }

    // 出力
    cout << (cnt == 1 && s[a] == '-' ? "Yes" : "No") << endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> data(n);

    int result = 0;
    for(int i = 0 ; i < n ; i++){
        cin >> data.at(i);
        if((i % 2) == 0){
            if((data.at(i) % 2) == 1){
                result++;
            }
        } 
    }

    cout << result << endl;
}

Measured memory_bytes: 3584
#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
int read_int(){int c,r;while((c=getchar())<48);r=c-48;while((c=getchar())>47)r=r*10+c-48;return r;}
void write_int(int x){int b[10],*p=b;do*p++=48+x%10,x/=10;while(x);do putchar(*--p);while(p>b);}

int main() {
  int n = read_int(), q = read_int();
  string s(n, 0);
  for (int i = 0; i <= n; ++i) s[i] = getchar();
  V< bitset<200000> > mask(26);
  for (int i = 0; i < n; ++i) {
    mask[s[i] - 'A'][i] = true;
  }
  auto imask = mask;
  for (auto&& e : imask) e.flip();
  V<char> t(q), d(q);
  for (int i = 0; i < q; ++i) {
    t[i] = getchar(), getchar();
    d[i] = getchar(), getchar();
  }
  bitset<200000> bs;
  for (int j = q - 1; j >= 0; --j) {
    if (d[j] == 'L') {
      auto nbs = bs << 1;
      nbs[0] = true;
      bs &= imask[t[j] - 'A'];
      bs |= nbs & mask[t[j] - 'A'];
    } else {
      auto nbs = bs >> 1;
      nbs[n - 1] = true;
      bs &= imask[t[j] - 'A'];
      bs |= nbs & mask[t[j] - 'A'];
    }
  }
  int res = n - bs.count();
  cout << res << '\n';
}

Measured memory_bytes: 2176
arr = gets.to_s.split(" ")

w = arr[0].to_i
h = arr[1].to_i
x = arr[2].to_i
y = arr[3].to_i
r = arr[4].to_i

if x >= r && y >= r && x <= w - r &&  y <= h - r then
  puts "Yes"
else
  puts "No"
end
  

Measured memory_bytes: 8684