akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
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;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  int N;
  cin >> N;
  
  int ans = 0;

  for (int i = 0; i < pow(4, 9); i++)
  {
    int maybe753 = 0;
    
    bool ok3 = false, ok5 = false, ok7 = false;
    bool ng = false;
    int ii = i;
    while (ii > 0)
    {
      maybe753 *= 10;
      if (ii % 4 == 1)
      {
        maybe753 += 3;
        ok3 = true;
      }
      else if (ii % 4 == 2)
      {
        maybe753 += 5;
        ok5 = true;
      }
      else if (ii % 4 == 3)
      {
        maybe753 += 7;
        ok7 = true;
      }
      else
      {
        ng = true;
        break;
      }
      
      ii /= 4;
    }
    
    if (ng) continue;
    
    if (maybe753 <= N && ok3 && ok5 && ok7)
    {
      ans++;
      //cerr << maybe753 << endl;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n, w, h, s, t;
		while (true) {
			n = sc.nextInt();
			if (n == 0) break;
			w = sc.nextInt(); h = sc.nextInt();
			boolean[][] map = new boolean[w][h];
			for (int i = 0; i < n; i++) 
				map[sc.nextInt()-1][sc.nextInt()-1] = true;
			s = sc.nextInt(); t = sc.nextInt();
			
			int count;
			int max = -1;
			for (int i = 0; i < w-s+1; i++) {
				count = 0;
				for (int k = i; k < i+s; k++) {
					for (int l = 0; l < t; l++) {
						if (map[k][l])
							count++;
					}
				}
				max = Math.max(max, count);
				for (int j = 1; j < h-t+1; j++) {
					for (int k = i; k < i+s; k++) {
						if (map[k][j-1]) count--;
						if (map[k][j+t-1]) count++;
					}
					max = Math.max(max, count);
				}
			}
			out.println(max);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

ll dp[100010];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,w;
    cin >> n >> w;
    ll g[n],v[n];
    rep(i,0,n) cin >> g[i] >> v[i];
    rep(j,0,n){
        rel(i,w+1,0){
            if(i+g[j] > w) continue;
            dp[i+g[j]] = max(dp[i+g[j]],dp[i]+v[j]);
        }
    }
    cout << dp[w] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#define print(x) cout << (#x) << " = " << (x) << endl
typedef long long ll;

using namespace std;

void fast_io(){
	//freopen("changing.in", "r", stdin);
	//freopen("changing.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

signed main(){
	fast_io();
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k-1]+='a' - 'A';
	cout << s;
	return 0;
}

Measured memory_bytes: 256
/**
*
* Author : MeGa
*
*/
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>
#include <unordered_set>


using namespace std;





long long dp[(int)2e5+7];
vector<int>v;

int n,a,b;
long long solve(int idx){
    
    if(idx==n-1){
        return 0;
    }
    long long &ret=dp[idx];
    if(ret!=-1)return ret;

    
    
    ret=min(solve(idx+1)+(a * (v[idx+1]-v[idx])),solve(idx+1)+b);
    cerr<<idx<<" "<<ret<<endl;
    
    return ret;
}
int main(){

#ifndef ONLINE_JUDGE
    //freopen("in","r",stdin);
#endif
     ios::sync_with_stdio(false);
     cin.tie(0);

    int n;
    cin>>n;
    long long ans=1;

    map<int,int>mp;
    for(int i=2;i<=n;i++){
        int t=i;
        int cnt=2;
        while(t>1){
            if(t%cnt==0){
                mp[cnt]++;
                t/=cnt;
            }else{
                cnt++;
            }
        }
    }

    int MOD=1e9+7;
    for(auto c:mp){
        c.second%=MOD;
        ans*=(c.second+1);
        ans%=MOD;
    }
    cout<<ans<<endl;
    

    
   

}

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

int main(){
    string s;
    cin >> s;
    int n = s.length();
    long long ans = 0;
    for(int i = 0; i < (1 << (n-1)); i++){
        long long temp = 0;
        int last = 0;
        for(int j = 0; j < n-1; j++){
            if(i & (1 << j)){
                temp += stol(s.substr(last, j+1-last));
                last = j+1;
            }
        }
        temp += stol(s.substr(last, n-last));
        ans += temp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
using namespace std;
int d[1000][1000], sx, sy;
char s[1000][1000];
int h,w,n;
int k, l;

int bfs(int,int,int,int);

int main(){
  int result = 0;
  int x[10], y[10], v;
  scanf("%d %d %d", &h, &w, &n);
  for(k = 0 ; k < h ; k++){
      scanf("%s",s[k]);
    }
  for( k = 0 ; k < h ; k++ ){
    for( l = 0 ; l < w ; l++){
      if(s[k][l] == 'S'){
	x[0] = l; y[0] = k;
      }
      if('1' <= s[k][l] && s[k][l] <= '9'){
	v = s[k][l]-'1'+1;
	x[v] = l; y[v] = k;
      }
    }
  }
  for (k = 1 ; k <= n ; k++){
   
    result += bfs(x[k-1],y[k-1],x[k],y[k]);
  }
  printf("%d\n", result);
  return 0;
}

int bfs(int sx, int sy, int gx, int gy){
  queue<int> Q;
  int i, j;
  int dx[4]={0, 1, 0, -1};
  int dy[4]={1, 0, -1, 0};
  

  for( i =  0 ; i < h ; i++ ){
    for( j = 0 ; j < w ; j++ ){
      d[i][j] = 1000000;
    }
  }

  Q.push(sy*w+sx);
  d[sy][sx]=0; /*スタート地点の初期化*/

  while( !Q.empty() ){
    int u = Q.front(); Q.pop();
    int pi = u/w;
    int pj = u%w;
    if( pi == gy && pj == gx )return d[gy][gx];
    for ( int r = 0; r < 4; r++ ){
      int ni = pi + dy[r];
      int nj = pj + dx[r];
      if ( ni < 0 || nj < 0 || ni >= h || nj >= w ) continue;
      if ( s[ni][nj] == 'X' ) continue;
      if( d[ni][nj] > d[pi][pj]+1 ){
      d[ni][nj] = d[pi][pj] + 1;
      Q.push( ni * w + nj );
      }

    }


  }
  //  printf("%d\n",u);
  return -1;
}

Measured memory_bytes: 5932
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << "  " << y << endl
#define dbg3(x, y, z) cout << x << "  " << y << "  " << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    string a, b;
    cin >> a >> b;
    if(a.length()+1 == b.length() ){
        if(b.substr(0, b.length() - 1).compare(a) == 0)
        cout << "Yes\n";
        else{
            cout << "No\n";
        }
    }
    else{
        cout << "No\n";
    }
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && a != c){
        cout << "Yes" << endl;
    }
    else if(a == c && a != b){
        cout << "Yes" << endl;
    }
    else if(b == c && b != a){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# Aizu Problem ITP_1_2_C: Sorting Three Numbers
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

a, b, c = sorted([int(_) for _ in input().split()])
print(a, b, c)

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

int main() {
  
  string a, b, c;
  cin >> a >> b >> c;
  
  char f = a.at(0);
  char s = b.at(0);
  char t = c.at(0);
  
  cout << f << s << t << endl;
 
 }

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

int main () {
  int n;
  cin >> n;
  int vec[n];
  for (int i = 1; i <= n; i++) {
    int tmp;
    cin >> tmp;
    vec[n - i] = tmp;
  }
  for (int i = 0; i < n; i++) {
    cout << vec[i];
    if (i != n-1) {
      cout << " ";
    }
    else {
      cout << endl;
    }
  }
}


Measured memory_bytes: 3116
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<map>
using namespace std;

#define ll long long

#define debug_message 0
#define debug if (debug_message)

#define sz(x) (int)x.size()

struct parent{
	int p1,p2;
	bool operator<(parent a2) const{
		return (p1<a2.p1 || (p1==a2.p1 && p2<a2.p2));
	}
};

int i,t,j;
int n,k,l,nt,p1[200005],p2[200005],v1,v2;
string s,s1,s2;

map<parent,int> mp;

int dsu1(int x){
	if (x==p1[x]) return x;
	else return (p1[x]=dsu1(p1[x]));
}

int dsu2(int x){
	if (x==p2[x]) return x;
	else return (p2[x]=dsu2(p2[x]));
}

int main(){
	scanf("%d%d%d",&n,&k,&l);
	
	for (i=1; i<=n; ++i) p1[i]=p2[i]=i;
	
	for (i=1; i<=k; ++i){
		scanf("%d%d",&v1,&v2);
		p1[dsu1(p1[v1])]=dsu1(p1[v2]);
	}
	
	for (i=1; i<=l; ++i){
		scanf("%d%d",&v1,&v2);
		p2[dsu2(p2[v1])]=dsu2(p2[v2]);
	}
	
	for (i=1; i<=n; ++i){
		++mp[(parent){dsu1(p1[i]),dsu2(p2[i])}];
	}
	
	for (i=1; i<=n; ++i) {
		printf("%d%c",mp[(parent){dsu1(p1[i]),dsu2(p2[i])}],i==n?'\n':' ');
	}
	
	return 0;
}
/*

*/

Measured memory_bytes: 16660
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w;
        w = sc.nextInt();
        int [] array;
        array = new int[w];
        int n;
        n = sc.nextInt();
        int i;
        for(i=0;i<w;i++){
            array[i] = i+1;
        }
        int a=0;
        int b=0;
        int swap;
        String str;
        String [] num = new String[2];
        for(i=0;i<n;i++){
            str = sc.next();
            num = str.split(",", 0);
            a=Integer.parseInt(num[0])-1;
            b=Integer.parseInt(num[1])-1;
            swap = array[a];
            array[a] = array[b];
            array[b] = swap;
            swap=0;
        }

        for(i=0;i<w;i++){
            System.out.println(array[i]);
        }
        sc.close();
    }
}


Measured memory_bytes: 26020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mi = -(1LL << 60); //MAX 9223372036854775807

int main()
{
ll n;
cin >> n ;
vector<vector<ll>> g(n);
//多重辺がないならsetでもよい（辺を消去したいときなど）この場合はinsert
//set<ll> g[n];
rep(i, n-1)
{
  ll a, b;
  cin >> a >> b;
  g[a - 1].push_back(b - 1);
  g[b - 1].push_back(a - 1); //無向辺
}
vector<ll> v(n,mi);
ll k ;
cin >> k ;
rep(i,k){
  ll a , b ;
  cin >> a >> b ;
  v[a-1]=b;
}
{
vector<ll> par(n);
vector<ll> dist(n);
vector<bool> see(n);
queue<ll> q;
par[0]=-1;
see[0]=1;
q.push(0);
while(!q.empty()){
  auto p=q.front();
  q.pop();
  for(auto r:g[p]){
    if(see[r]!=0)continue;
    par[r]=p;
    see[r]=1;
    dist[r]=dist[p]+1;
    q.push(r);
  }
}
bool kk;
rep(i,n){
  if(v[i]!=mi){kk=(v[i]%2)^(dist[i]%2);break;}
}
rep(i,n){
  if(v[i]!=mi&&kk!=(v[i]%2)^(dist[i]%2)){
    cout << "No" << endl;
    return 0;
  }
}
}
ll root=0;
vector<vector<ll>> child(n);
vector<vector<pair<ll,ll>>> cp(n);
vector<pair<ll,ll>> vp(n);
vector<ll> par(n);
queue<ll> q;
queue<ll> qq;
q.push(root);
par[root]=-1;
rep(i,n){
  if(v[i]!=mi)vp[i]={v[i],v[i]};
  else vp[i]={mi,mi};
}
//親の定義と葉を見つける
while(!q.empty()){
  ll p=q.front();
  q.pop();
  if(g[p].size()==1 && p!=root){qq.push(p);}
  for(auto r:g[p]){
    if(r==par[p])continue;
    par[r]=p;
    q.push(r);
  }
}
while(!qq.empty()){
  ll p=qq.front();
  qq.pop();
  child[par[p]].push_back(p);//親に値を追加する
  cp[par[p]].push_back(vp[p]);
  //根の時は例外処理
  if(child[par[p]].size()==g[par[p]].size()){
    //child[par[p]]に子の値が入ってる
    pair<ll,ll> r={mi,1LL<<50};
    for(auto rr:cp[par[p]]){
      if(rr.first==mi)continue;
      r.first=max(r.first,rr.first-1);
      r.second=min(r.second,rr.second+1);
    }
    if(r.first>r.second){
      cout << "No" << endl;return 0;
    }
    if(vp[par[p]].first!=mi&&(r.first>vp[par[p]].first||r.second<vp[par[p]].second)){
      cout << "No" << endl;return 0;
    }
    if(vp[par[p]].first!=mi){r=vp[par[p]];}
    if(r.first!=mi)vp[par[p]]=r;
  }
  //全ての葉が親に追加し終わった
  if(child[par[p]].size()==g[par[p]].size()-1 && par[p]!=root){
    //child[par[p]]に子の値が入ってる
    pair<ll,ll> r={mi,1LL<<50};
    for(auto rr:cp[par[p]]){
      if(rr.first==mi)continue;
      r.first=max(r.first,rr.first-1);
      r.second=min(r.second,rr.second+1);
    }
    if(r.first>r.second){
      cout << "No" << endl;return 0;
    }
    if(vp[par[p]].first!=mi&&(r.first>vp[par[p]].first||r.second<vp[par[p]].second)){
      cout << "No" << endl;return 0;
    }
    if(vp[par[p]].first!=mi){r=vp[par[p]];}
    if(r.first!=mi)vp[par[p]]=r;
    qq.push(par[p]);
  }
}
{
vector<bool> see(n);
queue<ll> q;
see[0]=1;
q.push(0);
while(!q.empty()){
  auto p=q.front();
  if(p==0)v[p]=vp[p].second;
  else v[p]=v[par[p]]+1;
  if(v[p]>vp[p].second)v[p]-=2;
  if(v[p]==mi)v[p]=v[par[p]]+1;
  if(p!=0&&abs(v[p]-v[par[p]])!=1){
    assert(0);
  }
  q.pop();
  for(auto r:g[p]){
    if(see[r]!=0)continue;
    see[r]=1;
    q.push(r);
  }
}
}
cout << "Yes" << endl;
rep(i,n)cout << v[i] << endl;
return 0;
}

Measured memory_bytes: 20448
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
#define ll getchar();getchar();return 0;
	using namespace std;
	signed main() {
		int a, b, x;
		cin >> a >> b >> x;
		if(a!=0&&b!=0)cout << b / x - (a - 1) / x << endl;
		else if (a == 0 && b == 0)cout << 1 << endl;
		else cout << b / x + 1 << endl;
		ll
}

Measured memory_bytes: 256
import numpy as np
def sieve(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        else:
            if i==2:
                is_prime[2] = False
            for j in range(i*2, n+1, i):
                is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

N = 10**5+10
primes= sieve(N)
set_primes = set(primes)
tank = [3]
for x in primes:
    if (x+1)//2 in set_primes:
        tank.append(x)

arr = [0]*N
for t in tank:
    arr[t] = 1
arr = np.cumsum(arr).tolist()
q = int(input())
for _ in range(q):
    l,r = map(int,input().split())
    print(arr[r] - arr[l-1])

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

int main(){
  int N,x;
  cin>>N;
  for(int i=9;i>0;i--){
  	if(N%i==0){
      x=N/i;
      break;
    }
  }
  if(x<10)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

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

void solve_A(){
	//AAAAAAAAAA
	int a,b;
	cin >> a >> b;
	cout << max(0,a-2*b) << endl;
}

void solve_B(){
	//BBBBBBBBBB
	int n,i,d[100],sum=0,sum2=0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> d[i];
		sum+=d[i];
		sum2+=(d[i]*d[i]);
	}
	cout << (sum*sum-sum2)/2 << endl;
}

void solve_C(){
	//CCCCCCCCCC
	int n,i,ans=1;
	char s[100005];
	cin >> n >> s;
	for(i=1;i<n;i++) if(s[i-1]!=s[i]) ans++;
	cout << ans << endl;
}

void solve_D(){
	//DDDDDDDDDD
	long long n,i,j,l,m,ans=0;
	vector<long long> g;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> l;
		g.push_back(l);
	}
	sort(g.begin(),g.end());
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			m=g[i]+g[j];
			ans += (n-(lower_bound(g.begin(),g.end(),m)-g.begin()));
		}
	}
	cout << n*(n-1)*(n-2)/6 - ans << endl;
}

int main() {
	// your code goes here
	//solve_A();
	//solve_B();
	solve_C();
	//solve_D();
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  long count = 0;
  vector<int> R(0), G(0), B(0), BB(N);
  for(int i = 0; i < N; i++) {
    char z; cin >> z;
    int y = i;
    if(z == 'R') {
      R.push_back(y);
    } else if(z == 'G') {
      G.push_back(y);
    } else if(z == 'B'){
      BB.at(y) = 1;
      B.push_back(y);
    }
  }
  //cout << B.size() << endl;
  for(int i = 0; i < (int)R.size(); i++) {
    for(int j = 0; j < (int)G.size(); j++) {
      int x = 0;
      x = max(G.at(j), R.at(i)) - min(R.at(i), G.at(j));
      //cout << x << " = x" << endl;
      count += (int)B.size();
      //cout << count << endl;
      if(min(R.at(i), G.at(j)) - x >= 0 && BB.at(min(R.at(i), G.at(j)) - x)) {
        count -= 1;
      }
      if(max(R.at(i), G.at(j)) + x < N && BB.at(max(R.at(i), G.at(j)) + x) == 1) {
        count -= 1;
      }
      if(x % 2 == 1) continue;
      x /= 2; if(BB.at((min(R.at(i), G.at(j)) + x)) == 1) {
        count -= 1;
      }
    }
  }
  cout << count << endl;
}

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

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  string ans ="No";
  for (int i = 0; i <= n/4; i++) {
    for (int j = 0; j <= n/7; j++) {
      if (4*i+7*j==n) ans = "Yes";
    }
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
Step = input()

easyStep = 'Yes'

for i in range(len(Step)):
    # odd
    if i % 2 == 0 and Step[i] == 'L':
        easyStep = 'No'
        break
    elif i % 2 == 1 and Step[i] == 'R':
        easyStep = 'No'
        break

print(easyStep)

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define ld long double
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 1e6 + 100;
vector<int> G[N];
int dep[N], ans[N];

void dfs(int u, int fa) {
    for (auto v:G[u]) {
        if (v == fa) continue;
        dep[v] = dep[u] + 1;
        dfs(v, u);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1, u, v; i < n; i++) {
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1, -1);
    vector<int> A, B, V[3], Ans[2];
    for (int i = 1; i <= n; i++) {
        if (dep[i] & 1) A.push_back(i);
        else B.push_back(i);
    }
    for (int i = 1; i <= n; i++) {
        V[i % 3].push_back(i);
    }
    if (A.size() >= V[1].size() && B.size() >= V[2].size()) {
        for (auto it:V[1]) Ans[0].push_back(it);
        for (auto it:V[2]) Ans[1].push_back(it);
        int t = A.size() - V[1].size();
        for (int i = 0; i < t; i++) Ans[0].push_back(V[0][i]);
        for (int i = t; i < V[0].size(); i++) Ans[1].push_back(V[0][i]);
    } else if (A.size() < V[1].size()) {
        for (int i = 0; i < A.size(); i++) Ans[0].push_back(V[0][i]);
        for (int i = A.size(); i < V[0].size(); i++) Ans[1].push_back(V[0][i]);
        for (auto it:V[1]) Ans[1].push_back(it);
        for (auto it:V[2]) Ans[1].push_back(it);
    } else {
        for (int i = 0; i < B.size(); i++) Ans[1].push_back(V[0][i]);
        for (int i = B.size(); i < V[0].size(); i++) Ans[0].push_back(V[0][i]);
        for (auto it:V[1]) Ans[0].push_back(it);
        for (auto it:V[2]) Ans[0].push_back(it);
    }
    for (int i = 0; i < A.size(); i++) {
        ans[A[i]] = Ans[0][i];
    }
    for (int i = 0; i < B.size(); i++) {
        ans[B[i]] = Ans[1][i];
    }
    for (int i = 1; i <= n; i++) {
        printf("%d%c", ans[i], i == n ? '\n' : ' ');
    }
    return 0;
}

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

int N;

int main()
{
    cin >> N;
    long long int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        ans += (tmp - 1);
    }
    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<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
signed main()
{
  int x=0,y=0,z=0,n=0,m=0,w=0;
  string s;
  std::cin >> s;
  std::cout << s[0]<<s.size()-2<<s[s.size()-1] << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
using namespace std;
using ll=int64_t;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
int main(){
    int n,ans=0;
    cin>>n;
    vi a(n);
    rep(i,n)
    cin>>a.at(i);
    rep(i,n){
        if(a.at(i)%2==1&&(i+1)%2==1)
        ++ans;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		int n, m, a; scanf("%d %d %d", &n, &m, &a);
		if (n == 0) break;
		a--;
		vector<vector<bool>> line(1000, vector<bool>(n, false));
		for (int i = 0; i < m; i++) {
			int h, p, q; scanf("%d %d %d", &h, &p, &q);
			h--; p--; q--;
			if (p > q) swap(p, q);
			line[999 - h][p] = true;
		}
		for (int i = 0; i < 1000; i++) {
			if (a != 0 and line[i][a - 1]) a = a - 1;
			else if (line[i][a]) a = a + 1;
		}
		printf("%d\n", a + 1);
	}
	return 0;

}


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

int main(){
    ll a, b; cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define repab(i,a,b) for(ll i=a;i<=b;i++)
#define ull unsigned long long int
#define ll long long int
#define LL_MAX 9223372036854775807
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define vl vector<ll>
#define bs(v,x) binary_search(v.begin(),v.end(),x)
#define popf pop_front
#define p() cout<<'\n'
#define p0(x) cout<<x<<" "
#define p1(x) cout<<x<<'\n'
#define p2(x,y) cout<<x<<" "<<y<<'\n'
#define p3(x,y,z) cout<<x<<" "<<y<<" "<<z<<'\n'
#define pr1(x) cout<<fixed<<setprecision(15)<<x<<'\n'
#define mod 1000000007
#define mod1 998244353
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define get(n) ll n;cin>>n
#define getvec(v,n) vector<ll> v(n);for(ll i=0;i<n;i++) cin>>v[i];
#define getstr(s) string s;cin>>s
#define all(x) x.begin(),x.end()
#define countBits(x) __builtin_popcount (x)
using namespace std;

int main(){
  fio;
  get(n);get(k);get(s);
  rep(i,k)
    p0(s);
  ll max=1000000000;
  repab(i,k,n-1){
    if(s!=max)
      p0(max);
    else
      p0(1);
  }
  p();
  return 0;
}


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

using i64 = int64_t;

struct Packet{
    int t, s, d;
    bool operator<(const Packet &obj)const{
        return t < obj.t;
    };
};

int main(){
    int n, m;
    while(cin >> n >> m, n != 0){
        vector<Packet> v;
        for(int i=0;i<m;++i){
            int t, s, d;
            cin >> t >> s >> d;
            v.push_back((Packet){t, s, d});
        }
        sort(v.begin(), v.end());
        set<int> infected;
        infected.insert(1);
        for(auto e: v){
            int s = e.s, d = e.d;
            if(infected.count(s))infected.insert(d);
        }
        cout << infected.size() << endl;
    }

    return 0;
}



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

int main( int argc, char *argv[] )
{
int A;
int B;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> A;
	cin >> B;
	if( A % 3 == 0 || B % 3 == 0 || ( A + B ) % 3 == 0)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;

	return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

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

   
   int W = stdIn.nextInt();
   int H = stdIn.nextInt();
   int x = stdIn.nextInt();
   int y = stdIn.nextInt();
   int r = stdIn.nextInt();
   
   if (x+r<=W && y+r<=H && x-r>=0 && y-r>=0){
System.out.println("Yes");
} else {
System.out.println("No");
}
 }
}


Measured memory_bytes: 26316
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n,m;
  while(cin>>n>>m,n+m){
    vector<int>tr(n);
    vector<int>ha(m);
    int tsum=0,hsum=0;
    for(int i=0;i<n;i++){
      cin>>tr[i];
      tsum+=tr[i];
    }
    for(int i=0;i<m;i++){
      cin>>ha[i];
      hsum+=ha[i];
    }
    bool flag=false;
    int ct=1e9,ht=1e9;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
	if((hsum-ha[j]+tr[i])==(tsum-tr[i]+ha[j])&&(ct+ht)>(ha[j]+tr[i])){
	  flag=true;
	  ct=tr[i];ht=ha[j];
	}
      }
    }
    if(flag)
      cout<<ct<<" "<<ht<<endl;
    else
      cout<<-1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k,sum=0;
	cin>>n>>k;
	int a[n+10]={0};
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a,a+n+1);
	for(int i=n;i>n-k;i--){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int x, y;

  scanf("%d%d",&x,&y);
 
  printf("%d\n", gcd(x,y));

  return 0;
}
	       
int gcd(int x,int y)
{
  int r,c;
  if(x < y){
    int c=x;
    x=y;
    y=c;
  }
  while(y>0)
    {
      r=x%y;
      x=y;
      y=r;
      // printf("r=%d x=%d y=%d", r, x, y);
    } 
  return x;
} 

Measured memory_bytes: 592
n, m = map(int, input().split())
inc = [0]*n
out = [[] for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  out[a].append(b)
  inc[b] += 1

S = {i for i, c in enumerate(inc) if c == 0}
L = []
 
while S:
    k = S.pop()
    L.append(k)
    for m in out[k]:
        inc[m] -= 1
        if inc[m] == 0:
            S.add(m)

dp = [0]*n
for i in L:
  for j in out[i]:
    dp[j] = max(dp[j], dp[i]+1)
print(max(dp))

Measured memory_bytes: 23588
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 200005
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
const ll mod = 1e9 + 7;

ll dp1[maxn];
ll dp2[maxn];
int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    string s;
    cin >> s;
    int n = s.length();

    dp1[0] = 0;
    dp2[0] = 1;

    for(int i = 0; i < n; i++){
        if(s[i] == '0'){
            dp1[i+1] = 3 * dp1[i] % mod;
            dp2[i+1] = dp2[i];
        }

        else{
            dp1[i+1] = (3 * dp1[i] + dp2[i]) % mod; // + 0 0
            dp2[i+1] = (2 * dp2[i]) % mod; // 0 1 1 0
        }
    }

    cout << (dp1[n] + dp2[n])% mod << endl;
    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);

    return 0;
}


Measured memory_bytes: 2000
#include <iostream>
#include <cstdio>
#include <vector>

enum DropSize {
	DropSize_S = 1,
	DropSize_M,
	DropSize_L
};

struct SinkCell {
	int x, y;
};

SinkCell sinkCellsForSizeS[] = {
	{0,0},{-1,0},{1,0},{0,-1},{0,1}
};
SinkCell sinkCellsForSizeM[] = {
	{-1,-1},{0,-1},{1,-1},{-1,0},{0,0},{1,0},{-1,1},{0,1},{1,1}
};
SinkCell sinkCellsForSizeL[] = {
	{0,-2},{-1,-1},{0,-1},{1,-1},{-2,0},{-1,0},{0,0},{1,0},{2,0},{-1,1},{0,1},{1,1},{0,2}
};

class Paper {
	int width_;
	int height_;
	std::vector<int> depth_;
	void SinkInk(int x, int y) {
		if (0 <= x && x < width_ && 0 <= y && y < height_) {
			++depth_[width_ * x + y];
		}
	}
	template<int count>
	void SinkInkToCells(int x, int y, const SinkCell (&cells)[count]) {
		for (int i = 0; i < count; ++i) {
			SinkInk(x + cells[i].x, y + cells[i].y);
		}
	}
public:
	explicit Paper(int width, int height) : width_(width), height_(height), depth_(width * height, 0)
	{
	}
	void DropInk(int x, int y, DropSize size)
	{
		if (0 <= x && x < width_ && 0 <= y && y < height_) {
			switch (size) {
				case DropSize_S:
					SinkInkToCells(x, y, sinkCellsForSizeS);
					break;
				case DropSize_M:
					SinkInkToCells(x, y, sinkCellsForSizeM);
					break;
				case DropSize_L:
					SinkInkToCells(x, y, sinkCellsForSizeL);
					break;
				default:
					break;
			}
		}
	}
	int Depth(int x, int y) const
	{
		return depth_[width_ * x + y];
	}
private:
};

int main()
{
	const int width = 10;
	const int height = 10;
	Paper paper(width, height);
	int x, y, size;
	while (std::scanf("%d,%d,%d", &x, &y, &size) == 3) {
		paper.DropInk(x, y, static_cast<DropSize>(size));
	}

	int maxDepth = 0;
	int whiteCount = 0;
	for (int x = 0; x < width; ++x) {
		for (int y = 0; y < height; ++y) {
			if (maxDepth < paper.Depth(x, y)) {
				maxDepth = paper.Depth(x, y);
			}
			if (paper.Depth(x, y) == 0) {
				++whiteCount;
			}
		}
	}

	std::printf("%d\n%d\n", whiteCount, maxDepth);

	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];
    int mn = 1000000;
    int mx = 0;
    for(int i=0; i<N; i++){
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    if(mn < mx-1){
        cout << "No" << endl;
        return 0;
    }

    if(mn == mx){
        if(mn == N-1 || mn <= N / 2) cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    int cnt_mn = 0;
    int cnt_mx = 0;
    for(int i=0; i<N; i++)
        if(a[i] == mn) cnt_mn++;
        else cnt_mx++;

    if(cnt_mn < mx && cnt_mx >= 2 && mx <= cnt_mn + cnt_mx / 2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

int main() {
    FAST;

    string s;
    cin >> s;

    if (s[s.size()-1] == 's') s += 'e';
    s += 's';

    cout << s;

    return 0;
}


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

int main() {
  int N, M;
  string A[50], B[50];
  int flag = 1;
  cin >> N >> M;

  for (int i = 0; i < N; i ++)
    cin >> A[i];

  for (int i = 0; i < M; i ++)
    cin >> B[i];

  for (int i = 0; i < N - M + 1 ; i++) {
    for (int j = 0; j < N - M + 1; j++) {
      flag = 1;
      for (int k = 0; k < M; k++) {
        for (int l = 0; l < M; l++) {
          if (A[k + i][l + j] != B[k][l])
            flag = 0;
        }
      }
      if (flag == 1) break;
    }
    if (flag == 1) break;
  }

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


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

long long int N, b, c;

int main(){
    scanf("%lld", &N);
    vector<long long> X(N), Y(N);
    for(int i = 0; i < N; Y[i] = X[i], ++i)scanf("%lld", &X[i]);
    sort(X.begin(), X.end());
    b = X[N / 2 - 1];
    c = X[N / 2];
    for(int i = 0; i < N; ++i){
        printf("%lld\n", Y[i] <= b ? c : b);
    }
    return 0;
}


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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int r; cin >> r;
  cout << 3*r*r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N), B(M), C(M);
    map<ll, ll> m;
    for (int i = 0; i < N; i++) {
      cin >> A[i];
      if (m.find(A[i]) == m.end()) m[A[i]] = 1;
      else m[A[i]]++;
    }
    for (int i = 0; i < M; i++) {
      cin >> B[i] >> C[i];
      if (m.find(C[i]) == m.end()) m[C[i]] = B[i];
      else m[C[i]] += B[i];
    }
    ll c = 0, sum = 0;
    for (auto it = m.rbegin(); it != m.rend(); ++it) {
      if (c + it->second >= N) {
        sum += it->first * (N - c);
        break;
      }
      c += it->second;
      sum += it->first * it->second;
    }
    cout << sum << endl;
}

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

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cerr << #v "=" << (v) << endl;
#define ppa(v) cerr << "- " << #v << endl; rep(i,v.size()) cerr << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(ALL(v)), v.end() );
#define INF 0x3f3f3f3f
#define LLINF 1000111000111000111LL
#define MOD 1000000007
#define TIME system("date +%M:%S.%N")
using Graph = vector<vector<int>>;
using ll = long long;
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

int main() {
  string s;cin>>s;
  int n = s.size();
  int k;cin>>k;
  vector<string> a;
  rep(i,n) {
    int len = min(n-i,k);
    rep(j,len) {
      string t = s.substr(i,j+1);
      a.push_back(t);
    }
  }
  sort(ALL(a));
  UNIQUE(a);
  string ans = a[k-1];
  cout << ans << endl;
}


Measured memory_bytes: 1660
#include <stdio.h>
int main(void){
    int i,j;
    
    float x1,y1;//A
    float x2,y2;//B
    float x3,y3;//C
    float x4,y4;//D

    scanf("%d",&j);
    for(i=0;i<j;i++){
        scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        
       
        if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3))
            printf("YES\n");
        else /*if(((y1-y2)/(x1-x2)) != ((y3-y4)/(x3-x4)))*/
            printf("NO\n");
    }
    return 0;
}




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

int main() {
	int N;
	cin >> N;
	vector<int> p(N);
	for (int i = 0; i < N; i++) {
		int n;
		cin >> n;
		p[i] = n;
	}
	int ng_count = 0;
	for (int i = 0; i < N; i++) {
		if (i + 1 != p[i]) ng_count++;
	}

	if (ng_count <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	cin >> N;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, l;
	while (cin >> n&& n != 0) {
		cin >> l;
		string h = "", s;
		for (int i = 0; i < n; i++)
			h += "IO";
		h += "I";
		cin >> s;
		int sum = 0;
		for (int i = 0; i < l - h.length(); i++) {
			string a = s.substr(i, h.length());
			if (a == h) sum++;
		}
		cout << sum << endl;
	}
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<long long> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  
  vector<long long> s(N + 1, 0);
  for(int i = 0; i < N; i++) s[i + 1] = s[i] + A[i];
  
  long long c = 1ll << 60;
  for(int i = 1; i < N; i++){
    c = min(abs(2 * s[i] - s[N]), c);
  }
  
  cout << c << endl;
  
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
    if (y == 0)
        return x;
    else 
        return gcd(y, x%y);
}

int main() {
    ll a, b, c, d;  cin >> a >> b >> c >> d;

    ll g = gcd(c, d);
    ll l = c / g * d;
    ll x = b - b/c - b/d + b/l;
    ll y = (a-1) - (a-1)/c - (a-1)/d + (a-1)/l;

    cout << x - y << endl;

    return 0;
}

Measured memory_bytes: 256
n, a, b, c, d = list(map(int, input().split()))
s = input()

ans = True

dp = [False]*n
dp[b-1] = True
# b→d
for i in range(b-1, d):
    if s[i] != ".":
        continue
    for j in range(1,3):
        if i+j < n:
            if s[i+j] != ".":
                continue
            if not dp[i+j]:
                dp[i+j] = dp[i]
if not dp[d-1]:
    ans = False


dp = [False]*n
dp[a-1] = True
# a→c
for i in range(a-1, c):
    if s[i] != ".":
        continue
    for j in range(1,3):
        if i+j < n:
            if s[i+j] != ".":
                continue
            if not dp[i+j]:
                dp[i+j] = dp[i]
if not dp[c-1]:
    ans = False

if d < c:
    l = max(b-2, 0)
    r = min(d, n-1)
    if "..." not in s[l:r+1]:
        ans = False

if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 47608
import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        if(a > b)System.out.println("a > b");
        if(a < b)System.out.println("a < b");
        if(a == b)System.out.println("a == b");

        scan.close();
    }
}


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

#define max_n 200000

int n;
int r[max_n] = {};


void solve(){
  int m[max_n];
  m[n-1] = r[n-1];
  for(int i=n-2; i >= 0; i--){
    m[i] = max(r[i+1], m[i+1]);
  }

  int ans, tmp;
  ans = -1000000001;
  for(int i=0; i<n-1; i++){
    tmp = m[i] - r[i];
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return ;
}

int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> r[i];
  }
  solve();
  return 0;
}

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

l1 = list(range(K, N + 1, K))
l2 = list(range(K//2, N + 1, K))

s1 = len(l1)
s2 = len(l2)

rev = int(s1**3)
if K % 2 == 0:
    rev += int(s2**3)
print(rev)

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

int main(){
	ll n,k;
	string s;
	cin>>n;
	cin>>s;
	cin>>k;
	for(ll i=0;i<n;i++){
		if(s[k-1]!=s[i]){
			s[i]='*';
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n,K,a[110],dp[110][110][300],ans;
signed main(){
	cin>>n>>K;
	rep(i,n)cin>>a[i];
	init_fact(1000);
	dp[0][0][0]=1;
	rep(i,n){
		rep(j,i+1){
			rep(k,300){
				dp[i+1][j+1][(k^a[i])]+=dp[i][j][k];
				dp[i+1][j+1][(k^a[i])]%=MOD;
				dp[i+1][j][k]+=dp[i][j][k];
				dp[i+1][j][k]%=MOD;
			}
		}
	}
	rep(i,300){
		ans+=dp[n][i][K]*kaijo[i]%MOD;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 27008
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a;
  int b[1000000],dp[1000000]={};
  cin>>a;
  for(int i=0;i<a;i++) cin>>b[i];
  dp[1]=abs(b[0]-b[1]);
  for(int i=2;i<a;i++){
    dp[i]=min(abs(b[i]-b[i-1])+dp[i-1],abs(b[i]-b[i-2])+dp[i-2]);
  }
  cout<<dp[a-1]<<"\n";
  }

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

int main()
{
  long long int num, a;
  cin >> num >> a;
  
  int loss = num / a;
  
  if(num==1) cout << 1 << endl;
  else if(a==1) cout << num << endl;
  else if(num % a == 0) cout << loss << endl;
  else cout << loss + 1 << endl;
}

Measured memory_bytes: 256
H,W,M=map(int,input().split())
L=[]
bh=[0]*(H+1)
bw=[0]*(W+1)
for _ in range(M):
    h,w=map(int,input().split())
    L.append((h,w))
    bh[h]+=1
    bw[w]+=1
p,q=max(bh),max(bw)
num=len(list(filter(p.__eq__, bh)))*len(list(filter(q.__eq__,bw)))
num-=len(list(filter(lambda x: bh[x[0]]==p and bw[x[1]]==q, L)))
ans=p+q-1
if num>0:
    ans+=1
print(ans)

Measured memory_bytes: 137236
H, W, A, B = map(int, input().strip().split())

if A * 2 <= W and B * 2 <= H:
	row = []
	for x in range(W):
		if x < A:
			row.append("1")
		else:
			row.append("0")
	row_str = "".join(row)
	for y in range(B):
		print(row_str)
	
	row = []
	for x in range(W):
		if x < A:
			row.append("0")
		else:
			row.append("1")
	row_str = "".join(row)
	for y in range(H - B):
		print(row_str)
else:
	print("No")


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

bool solve(int a, int b) {
	return a%3 == 0 || b%3 == 0 || (a+b)%3 == 0;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << (solve(a, b) ? "Possible" : "Impossible") << endl;
}

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

int main() {
    int n, x;
    cin >> n >> x;

    while(!(n == 0 && x == 0)) {
        vector<vector<vector<int>>> vec(n+1, vector<vector<int>>(n+1, vector<int>(n+1, 0)));
        vector<int> nums(3, 0);

        int count = 0;
        int n_sum;
        for(int i=1; i<=n; ++i) {
            for(int j=1; j<=n; ++j) {
                if (i == j) continue;
                for(int k=1; k<=n; ++k) {
                    if (i == k || j == k) continue;
                    n_sum = i + j + k;
                    if (n_sum == x) {
                        nums[0] = i;
                        nums[1] = j;
                        nums[2] = k;
                        sort(nums.begin(), nums.end());
                        if (vec[nums[0]][nums[1]][nums[2]] == 0) {
                            count++;
                            vec[nums[0]][nums[1]][nums[2]] = 1;
                        }
                    }
                }
            }
        }

        cout << count << endl;
        cin >> n >> x;
    }

    return 0;
}


Measured memory_bytes: 7368
fun main(args : Array<String>) {
    var price = readLine()!!.toInt()

    var ok = false
    var current = 0
    while (current <= price){
        if ((price - current) % 7 == 0){
            ok = true
            break
        }
        current += 4
    }
    if (ok){
        println("Yes")
    }else{
        println("No")
    }
}

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

typedef long long ll;

int main(){
	static ll N,E,T;
	static ll x[100010];
	scanf("%lld%lld%lld",&N,&E,&T);
	for(int i = 1 ; i <= N ; i ++){
		scanf("%lld",&x[i]);
	}
	
	static ll dp1[100010];
	static ll dp2[100010];
	for(int i = 0 ; i < 100010 ; i ++){
		dp1[i] = dp2[i] = 1000000000000000000;
	}
	dp1[0] = 0;
	int r = 1;
	for(int i = 1 ; i <= N ; i ++){
		dp1[i-1] = min( dp1[i-1] , dp2[i-1] );
		dp2[i] = min( dp2[i] , dp2[i-1]+2*(x[i]-x[i-1]) );
		while(r+1 <= N && 2*(x[r+1]-x[i]) <= T)r ++;
		dp1[r] = min( dp1[r] , dp1[i-1]+T );
		if(r+1 <= N)dp2[r+1] = min( dp2[r+1] , dp1[i-1]+2*(x[r+1]-x[i]) );
	}
	cout << min(dp1[N],dp2[N])+E << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
const int inf = 1e9;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<int> p(n+2), t(n+2);
		for(int i=1; i<=n; i++){
			cin >> p[i] >> t[i];
		}
		p[0]=0; t[0]=0;
		p[n+1]=0; t[n+1]=inf;
		
		vector<vector<int> > dp(n+2, vector<int>(3, inf));
		dp[0][0]=0;
		for(int i=0; i<n+1; i++){
			for(int j=0; j<=2; j++){
				if(dp[i][j]==inf) continue;
				if(j!=2 && abs(p[i+1]-p[i])*(j+2)<=t[i+1]-t[i]){
					dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+abs(p[i+1]-p[i]));
				}
				if(p[i]*(j+2) +p[i+1] <= t[i+1]-t[i]){
					dp[i+1][0] = min(dp[i+1][0], dp[i][j]+p[i]+p[i+1]);
				}
			}
		}
		if(dp[n+1][0]==inf){
			for(int i=n+1; i>=0; i--){
				for(int j=0; j<=2; j++){
					if(dp[i][j]!=inf){
						cout << "NG " << i+1 << endl;
						i=0;
						break;
					}
				}
			}
		}else{
			cout << "OK " << dp[n+1][0] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i=0; i<n; i++)
 
using namespace std;
const double PI = acos(-1);
using Graph = vector<vector<int>>;
 
int main() {
	int n;
	cin >> n;
	if (n%1000 == 0)
		cout << 0 << endl;
	else
		cout << (n/1000 + 1) * 1000 - n << endl;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int p = 0;
    for(int i=0;i<n;++i)
        if(s[i] == 'p')p++;

    cout << n/2 - p << endl;

    return 0;
}


Measured memory_bytes: 512
a, b, c = map( int, input().split() )
 
if a == 5 and b == 5 and c == 7:
	print( "YES" )
elif a == 5 and b == 7 and c == 5:
  	print( "YES" )
elif a == 7 and b == 5 and c == 5:
  	print( "YES" )
else :
	print( "NO" )

Measured memory_bytes: 2940
N = int(input())
T = [[] for k in range(N)]
for p in range(N):
    A = int(input())
    for k in range(A):
        x, y = map(int,input().split())
        T[p].append([x-1,y])

ans = 0
for k in range(2**N):
    t = []
    f = []
    for d in range(N):
        if (k>>d)&1 == 1:
            t.append(d)
        else:
            f.append(d)
    flag = 1
    for p in range(N):
        if p in t:
            for e in T[p]:
                if e[1] == 1 and e[0] in f:
                    flag = 0
                    break
                elif e[1] == 0 and e[0] in t:
                    flag = 0
                    break
    if flag == 1:
        ans = max(ans,len(t))
print(ans)


Measured memory_bytes: 47468