akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<int, string> PSI;

int n;

set<int> si;
set<int>::iterator it, it2;

int main(){
	while (cin >> n&&n){
		int cnt[10000] = {};
		FOR(i, 1, n){
			si.insert((i*i) % n);
		}
		for (it = si.begin(); it != si.end(); it++){
			for (it2 = si.begin(); it2 != si.end(); it2++){
				if (it == it2)continue;
				int num = *it - *it2;
				if (num < 0)num += n;
				if (num > (n - 1) / 2)num = n - num;
				cnt[num]++;
			}
		}
		FOR(i, 1, (n - 1) / 2 + 1){
			cout << cnt[i] << endl;
		}
		si.clear();
	}
}

Measured memory_bytes: 1472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//最大公約数
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  ll r = a % b;
  while (r) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main() {
  ll n;
  cin >> n;

  vll t(n);
  for (ll i = 0; i < n; i++) cin >> t[i];

  long double ans = 1;
  for (ll i = 0; i < n; i++) {
    ans = ans / gcd(ans, t[i]) * t[i];
  }

  cout << (ll)ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC061A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b, c;

			var word = Console.ReadLine().Split(' ');

			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);

			if (a <= c && c <= b)
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}

			Console.ReadKey();
		}
	}
}


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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a') {
    cout << "vowel" << endl;
  } else if (c == 'e') {
    cout << "vowel" << endl;
  } else if (c == 'i') {
    cout << "vowel" << endl;
  } else if (c == 'o') {
    cout << "vowel" << endl;
  } else if (c == 'u') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
 
  // ここにプログラムを追記
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;

const int MOD = 1e9 + 7;

int n, m, k;
int pow1[1010101], pow2[1010101];
int fac[1010101], rev[1010101], ifac[1010101];

int c(int a, int b)
{
	long long ret = fac[b];
	ret = ret * ifac[a];
	ret %= MOD;
	ret = ret * ifac[b - a];
	ret %= MOD;
	return (int)ret;
}

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	pow1[0] = fac[0] = ifac[0] = rev[0] = pow2[0] = 1;
	ifac[1] = rev[1] = 1;
	for(int i = 1; i <= n + m + k; ++i)
	{
		pow1[i] = pow1[i - 1] * 3ll % MOD;
		pow2[i] = pow2[i - 1] * 2 % MOD;
		fac[i] = fac[i - 1] * 1ll * i % MOD;
		if(i >= 2)
		{
			rev[i] = MOD - 1ll * (MOD / i) * rev[MOD % i] % MOD;
			ifac[i] = 1ll * ifac[i - 1] * rev[i] % MOD;
		}
	}
	if(m > k)
		swap(m, k);
	int ans = 0;
	for(int i = 0; i <= m; ++i)
	{
		ans += 1ll * pow2[i] * c(i, i + n - 1) % MOD * pow1[m + k - i] % MOD;
		if(ans >= MOD)
			ans -= MOD;
	}
	int lst = pow2[m];
	for(int i = m + 1; i <= m + k; ++i)
	{
		lst = lst<<1;
		lst -= c(m, i - 1);
		if(lst >= MOD)
			lst -= MOD;
		if(i > k)
			lst -= c(i - k - 1, i - 1);
		while(lst < 0)
			lst += MOD;
		while(lst >= MOD)
			lst -= MOD;
		ans += 1ll * lst * c(i, i + n - 1) % MOD * pow1[m + k - i] % MOD;
		if(ans >= MOD)
			ans -= MOD;
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 19584
#include <stdio.h>

int main(void)
{
  int n, k;
  int x[100];
  int count = 0;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
    if (x[i] < k - x[i])
      count += x[i];
    else
      count += k - x[i];
  }
  printf("%d\n", 2 * count);
}


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

int main(){
    int a,b;
    cin>>a>>b;
    if((a+b)%3==0) cout<<"Possible"<<endl;
    else if(a%3==0) cout<<"Possible"<<endl;
    else if(b%3==0) cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int ans = 10000000000000000;
	long long int i;
	for (i = 1; i * i <= n; i++)
		if (n % i == 0)
			if (i + n / i < ans)
				ans = n / i + i - 2;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
N = input()
cnt = 0
ans = 0
for i in range(len(N)):
  if (N[i] == 'A') or (N[i] == 'C') or (N[i] == 'G') or (N[i] == 'T'):
    cnt += 1
    ans = max(cnt, ans)
  else:
    cnt = 0
print(ans)

Measured memory_bytes: 61796
/*
      @author: Charan Sai
*/
#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define ppi pair<int, int>
#define INT INT_MAX
#define endl "\n"
#define nl cout << "\n"
#define deb(x) cout << #x << " " << x << endl;

const int M = 1e5 + 1;
int N, W;
int wt[M], val[M];

/*
Normal knapsack has O(N*W) time. But when W is really huge then we will get TLE.
So we can't use W. The only thing left is val. We will use it.
Prev, dp[i][j] = Max value obtained for 1....i items and sum of weight of items is j
Now, dp[i][j] = Min weight needed to get j value using 1....i items
*/
// O(N * Weight) Time & Space
int Bottom_Up() {
    // maximum value we can get by including all items
    int max_val = 0;
    for(int value : val) max_val += value;
    vector<vector<int>> dp(N+1, vector<int>(max_val+1, INT_MAX));
    
    // Base case
    for(int i = 0; i <= N; ++i) dp[i][0]=0;
    // Recurrence
    for(int i = 1; i <= N; ++i) {
        for(int value = 1; value <= max_val; ++value) {
            if(val[i] > value) {
                dp[i][value] = dp[i-1][value];
                continue;
            }
            int incl = dp[i-1][value - val[i]] + wt[i];
            int excl = dp[i-1][value];
            dp[i][value] = min(incl, excl);
        }
    }
    for(int value = max_val; value >= 0; --value) {
        if(dp[N][value] <= W) return value;
    }
    return -1;
}

int32_t main() {
    IOS;
    cin >> N >> W;
    // vector<vector<int>> dp(N+1, vector<int>(W+1, -1));
    for(int i = 1; i <= N; ++i) {cin >> wt[i]; cin >> val[i];}
    cout << Bottom_Up() << endl;
}

Measured memory_bytes: 80256
namespace ABC130.A
{
    using System.Collections.Generic;
    using System.Linq;
    using static System.Console;




    public class Program
    {
        public static void Main(string[] args)
        {
            var l = ReadInputsAsInt().ToList();

            WriteLine(Solve(l[0], l[1]));
        }

        public static int Solve(int x, int a) => x < a ? 0 : 10;

        static IEnumerable<int> ReadInputsAsInt() => ReadLine().Split(' ').Select(x => int.Parse(x));
    }
}


Measured memory_bytes: 13268
R, G, B, N = gets.chomp.split.map(&:to_i)

p (0..N/R).inject(0) {|sum, i|
    (0..N/G).each {|j|
        x = N - R*i - G*j
        sum += x % B == 0 && x >= 0 ? 1 : 0
    }
    
    sum
}

Measured memory_bytes: 1788
def main():
    S, T = input().split(' ')
    A, B = map(int, input().split(' '))
    U = input()

    if U == S:
        A -= 1
    if U == T:
        B -= 1
    
    print('{} {}'.format(A,B))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 10000007;
const int inf = 1001001001;



int main(void) {
  int h,w,n;
  cin >> h >> w >> n;
  cout << (n+max(h,w)-1)/max(h,w) << endl;
  
}


Measured memory_bytes: 256
a = input()
#print(a)
a = list(map(int, input().split()))
bob = 0
for x in a:
    bob += x
mary = 0
for x in a:
    if (bob/2-mary)**2>(bob/2-(mary+x))**2:
        mary += x
    else:
        break

print(abs((bob-mary)-mary))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
struct p{
	int x,y;
}a[N],b[N];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i].x>>a[i].y;
	for(int i=1;i<=m;i++) cin>>b[i].x>>b[i].y;
	for(int i=1;i<=n;i++){
		int id=0,mx=1e9,x=-1;
		for(int j=1;j<=m;j++){
			int tmp=abs(a[i].x-b[j].x)+abs(a[i].y-b[j].y);
			if(mx>tmp){
				mx=tmp,id=j,x=b[j].x;
			}
			else if(mx==tmp&&b[j].x<x) x=b[j].x,id=j; 
		}
		printf("%d\n",id);
	}
	return 0;
}

Measured memory_bytes: 3756
N = int(input())
A = list(map(int, input().split()))

ans = []
num_box = []
for i in range(N):
    num_box.append([i+1, A[i]])

num_box.sort(key=lambda x: x[1])
for i in range(N):
    ans.append(num_box[i][0])

print(' '.join(map(str, ans)))

Measured memory_bytes: 28384
N = int(input())
h = list(map(int,input().split()))
if max(h) == min(h):
    ans = h[0]

else:
    same = []
    for i in range(N-1):
        if h[i] == h[i+1]:
            same.append(i)
    
    if len(same) >= 1:
        for k in range (len(same))[::-1]:
            del h[same[k]]
    
    N = len(h)

    lmin = [] #極小値のリスト
    lmax = [] #極大値のリスト

    if N >=3:
        for i in range(1,N-1):
            if (h[i] > h[i-1]) and (h[i] > h[i+1]):
                lmax.append(h[i])
        
        for k in range(1,N-1):
            if (h[k] < h[k-1]) and (h[k] < h[k+1]):
                lmin.append(h[k])

        if h[0] > h[1]:
            lmax.append(h[0])
            
        if h[N-1] > h[N -2]:
            lmax.append(h[N-1])
                
        if (len(lmax) == 1) :
            ans = max(h)

        else:
            ans = sum(lmax) - sum(lmin)
    
    if N == 2:
        ans = max(h)

    if N == 1:
        ans = h[0]

#print(lmax)
#print(lmin)
print(ans)


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int a;
  string S;
  cin >> a >> S;

  if(a >= 3200){
    cout << S << endl;
  }else{
    cout << "red" << endl;
  }


  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}

void Yn(bool f)
{
  cout << (f ? "Yes" : "No") << endl;
}

void yn(bool f)
{
  cout << (f ? "yes" : "no") << endl;
}

void YN(bool f)
{
  cout << (f ? "YES" : "NO") << endl;
}

int a, b, t;

int main()
{
  cin >> a >> b >> t;
  cout << (t/a)*b << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main implements Runnable {
    public void solve() throws Exception {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        boolean flag = false;
        for (int i = a; i <= b; i++) {
            if (i%k==0){
                flag = true;
                break;
            }
        }
        out.println(flag?"OK":"NG");
    }

    //main function//
    public static PrintWriter out;
    public static void main(String[] args) throws Exception {
        new Thread(null, new Main(), "", 1 << 26).start();
    }
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    public void run() {
        try {
           solve();
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        } finally {
            out.close();
        }
    }
}


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

using namespace std;

const int N = (int)1e5 + 5;

int c[N];
int dis[N], from[N];
vector <int> es[N];

vector <int> getPath(const int& s, const int& t) {
  memset(dis, 0x7f, sizeof(dis));
  dis[s] = 0;
  deque <int> de;
  de.push_back(s);
  while (!de.empty()) {
    int u = de.front();
    de.pop_front();
    for (int i = 0; i < (int)es[u].size(); ++i) {
      int v = es[u][i];
      if (dis[v] == 0x7f7f7f7f) {
        dis[v] = dis[u] + 1;
        from[v] = u;
        de.push_back(v);
      }
    }
  }
  int temp = t;
  vector <int> ret;
  while (temp != s) {
    ret.push_back(temp);
    temp = from[temp];
  }
  ret.push_back(s);
  return ret;
}

int dfs(const int& f, const int& u, const int& col) {
  if (c[u] != 0 && c[u] != col)
    return 0;
  c[u] = col;
  int ret = 1;
  for (int i = 0; i < (int)es[u].size(); ++i) {
    if (es[u][i] == f)
      continue;
    ret += dfs(u, es[u][i], col);
  }
  return ret;
}

int main()
{
  ios::sync_with_stdio(false);
  int n, u, v;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> v >> u;
    es[v].push_back(u);
    es[u].push_back(v);
  }
  vector <int> path = getPath(1, n);
  int len = (int)path.size();
  for (int i = 0; i < len / 2; ++i)
    c[path[i]] = 1;
  for (int i = len / 2; i < len; ++i)
    c[path[i]] = 2;
  cout << (dfs(-1, 1, 2) > dfs(-1, n, 1) ? "Fennec" : "Snuke") << '\n';
  return 0;
}

Measured memory_bytes: 9720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC69_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split();
            var n = long.Parse(s[0]);
            var m = long.Parse(s[1]);
            if (m >= 2 * n)
            {
                long i = (m - 2 * n) / 4;
                Console.WriteLine(n + i);
            }
            else
            {
                Console.WriteLine(Math.Min(n, m/2));
            }
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define NMAX 100004
const int INF = 0x3f3f3f3f;
int height[NMAX]={0};
int dp[NMAX];
int n,k;

int min(int a,int b){
  return a<b ? a : b ;
}
int solve (int x){
  int some1=INF;
  if (x==n) {
      return 0;
    }
  if (dp[x]!=-1) {
      return dp[x];
  }
  if(x>n)
      return INF;
  if (dp[x]!=-1) {
      return dp[x];
    }
    for (int i = 1; i <=k; i++) {
       some1=min(some1,(abs(height[x]-height[x+i])+solve(x+i)));
    }
    return dp[x]=some1;
}
int main() {
for (int i = 0; i < NMAX; i++) {
    dp[i]=-1;
  }
  scanf("%d",&n);
  scanf("%d",&k);
for (int i = 1; i <=n; i++) {
  scanf("%d",&height[i]);
}
printf("%d",solve(1));
return 0;
}



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

int main(){
        int h,w,i,j,y,x,cnt=0;
        queue<int> qy;
        queue<int> qx;
        cin >> h >> w;
        vector<vector<char>> s(h, vector<char>(w));
        vector<vector<int>> d(h, vector<int>(w));
        for(i=0;i<h;++i){
                for(j=0;j<w;++j){
                        cin >> s[i][j];
                        if(s[i][j]=='.') cnt += 1;
                }
        }
        qy.push(0);
        qx.push(0);
        d[0][0] = 1;
        while(!qy.empty()){
                y = qy.front(); qy.pop();
                x = qx.front(); qx.pop();
                if(x+1<w && s[y][x+1]=='.' && d[y][x+1]==0){
                        qy.push(y);
                        qx.push(x+1);
                        d[y][x+1] = d[y][x]+1;
                }
                if(x-1>=0 && s[y][x-1]=='.' && d[y][x-1]==0){
                        qy.push(y);
                        qx.push(x-1);
                        d[y][x-1] = d[y][x]+1;
                }
                if(y+1<h && s[y+1][x]=='.' && d[y+1][x]==0){
                        qy.push(y+1);
                        qx.push(x);
                        d[y+1][x] = d[y][x]+1;
                }
                if(y-1>=0 && s[y-1][x]=='.' && d[y-1][x]==0){
                        qy.push(y-1);
                        qx.push(x);
                        d[y-1][x] = d[y][x]+1;
                }
        }
        if(d[h-1][w-1]==0) cout << -1 << endl;
        else cout << cnt - d[h-1][w-1] << endl;
        return 0;
}

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

using namespace std;
typedef long long ll;
ll dp[32][1 << 12];

int main(){
	ios_base::sync_with_stdio(false);
	while(true){
		int n, m;
		cin >> n >> m;
		if(n == 0 && m == 0){ break; }
		vector<string> patterns(n);
		for(int i = 0; i < n; ++i){ cin >> patterns[i]; }
		string text;
		for(int i = 0; i < m; ++i){
			string line;
			cin >> line;
			text += line;
		}
		const int length = text.size();
		vector<int> match(length);
		for(int i = 0; i < n; ++i){
			const int p = patterns[i].size();
			for(int j = 0; j + p <= length; ++j){
				int flag = 1;
				for(int k = 0; flag && k < p; ++k){
					if(text[j + k] != patterns[i][k]){ flag = 0; }
				}
				match[j] |= (flag << i);
			}
		}
		memset(dp, 0, sizeof(dp));
		ll answer = 0;
		for(int i = 0; i < length; ++i){
			const int cur = i & 31, next = (i - 1) & 31;
			for(int j = 0; j < (1 << n); ++j){ dp[next][j] = 0; }
			dp[cur][0] = 1;
			for(int j = 0; j + 1 < (1 << n); ++j){
				int mask = match[i] & ~j;
				while(mask != 0){
					const int shift = __builtin_ctz(mask);
					mask &= mask - 1;
					const int a = (i + patterns[shift].size()) & 31;
					const int b = j | (1 << shift);
					dp[a][b] += dp[cur][j];
				}
			}
			if(dp[(cur + 1) & 31][(1 << n) - 1]){ ++answer; }
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 2284
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        if ((n % 2) == 0) {
            System.out.println(n / 2);
        } else {
            System.out.println((n / 2) + 1);
        }
        sc.close();
    }
}


Measured memory_bytes: 35768
#include <iostream>

using namespace std;

int main(){
	long long N, M;
	cin >> N >> M;

	if (M % 2){
		for (int i = 0; i < M/2; i++){
			cout << i + 1 << " " << M - i << endl;
		}
		for (int i = 0; i < M/2 + 1; i++){
			cout << M + i + 1 << " " << 2 * M - i + 1 << endl;
		}
	} else {
		for (int i = 0; i < M/2; i++){
			cout << i + 1 << " " << M - i + 1 << endl;
			cout << M + i + 2 << " " << 2 * M - i + 1 << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3672
#include<stdio.h>
#include<string.h>

int main(void){
    char p1[100],p2[200],q[100];
    
    scanf("%s %s",p1,q);
    strcpy(p2,p1);
    strcat(p2,p1);
    
    if(strstr(p2,q)!=NULL){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define ll long long
#define ull  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 201000;
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    int n = s.length();
    for (int i = 0; i < n - 1; i++){
        if (s[i] == 'A' && s[i + 1] == 'C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        while (true){
            int n = sc.nextInt();
            int x = sc.nextInt();
            if (n == 0 && x == 0){
                break;
            }
            int count = 0;
            for (int i = 1; i <= n - 2; i++){
                for (int j = i + 1; j <= n - 1; j++){
                    for (int k = j + 1; k <= n; k++){
                        if (i + j + k == x)
                            count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
}



Measured memory_bytes: 26296
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
///                    BISMILLAHIR RAHMANIR RAHIM

int main()
{
 ll n,m;
 cin>>n>>m;
 if(n==1 || m==1){
    cout<<1<<endl;
    return 0;
 }
 ll ans=(n*m+1)/2;
 cout<<ans<<endl;
 return 0;
}

/// A L H A M D U L I L L A H


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

ll gcd(ll n, ll m)
{
  if (n % m == 0)
  {
    return (m);
  }
  else
  {
    return (gcd(m, n % m));
  }
};

ll lcm(ll n, ll m)
{
  return n * m / gcd(n, m);
};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll total = b / c + b / d - (b / lcm(c, d));
  ll sub = (a - 1) / c + (a - 1) / d - ((a - 1) / lcm(c, d));
  cout << b - a + 1 - (total - sub) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	long long int a;
	long long int num = 1;
	long long int cnt = 0;
	scanf("%lld", &a);
	while (a >= 1)
	{
		a = a / 2;
		cnt = cnt + num;
		num = num * 2;
	}
	printf("%lld",cnt);
        return 0;
}

Measured memory_bytes: 128
import fractions
n=int(input())
nums=list(map(int,input().split()))
def g(a,b):
  if a==0:return b
  if b==0:return a
  return fractions.gcd(a,b)
l=[0]*(n+1)
r=[0]*(n+1)
for i in range(1,n+1):
  l[i]=g(l[i-1],nums[i-1])
for i in range(n)[::-1]:
  r[i]=g(r[i+1],nums[i])
ans=0
for i in range(n):
  c=g(l[i],r[i+1])
  if c>ans:ans=c
print(ans)

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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}
template <typename T> 
T Min(T a,T b){ return a<b?a:b; }
template <typename T>
T Max(T a,T b){ return a>b?a:b; }

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	int n;cin>>n;
	n>=30?cout<<"Yes\n":cout<<"No\n";
	
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



Measured memory_bytes: 3608
#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 dp[105][4][2];

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int k;
    cin >> k;
    dp[0][0][0] = 1;
    rep(i,n) rep(j,k+1) rep(l,2) {
        int a = s[i] - '0';
        rep(m, 10) {
            int ni = i+1, nj = j, nl = l;
            if (m != 0) nj++;
            if (nj > k) continue;
            if (l == 0) {
                if (m > a) continue;
                if (m < a) nl = 1;
            }
            dp[ni][nj][nl] += dp[i][j][l];
        }
    }
    int ans = dp[n][k][0] + dp[n][k][1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
use std::cmp::max;
fn main() {
    let (n,c) = {
        let s = rv::<i64>();
        (s[0]as usize,s[1])
    };
    let mut xv = Vec::with_capacity(n);
    for _ in 0..n {
        let s = rv::<i64>();
        xv.push((s[0],s[1]));
    }
    let mut cw = vec![0;n+1];
    let mut cwr = vec![0;n+1];
    let mut w = 0;
    for (i,&(x,v)) in xv.iter().enumerate() {
        w+=v;
        cw[i+1] = max(cw[i], w-x);
        cwr[i+1] = max(cwr[i], w-x*2);
    }
    let mut ccw = vec![0;n+1];
    let mut ccwr = vec![0;n+1];
    let mut w = 0;
    for (i,&(x,v)) in xv.iter().enumerate().rev() {
        w+=v;
        ccw[i] = max(ccw[i+1],w-(c-x));
        ccwr[i] = max(ccwr[i+1],w-(c-x)*2);
    }
    let mut t=0;
    for i in 0..n+1 {
        t = max(t, max(cw[i]+ccwr[i],cwr[i]+ccw[i]));
    }
    println!("{}",t);
}
fn rl() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s
}
fn rv<T>() -> Vec<T>
  where T: std::str::FromStr, T::Err: std::fmt::Debug, {
    rl().split_whitespace().map(|x|x.parse::<T>().unwrap()).collect()
}

Measured memory_bytes: 10492
#include <stdio.h>

int main()
{   long long n,m;
    scanf("%lld%lld",&n,&m);
    if(m<=n*2){
        printf("%lld",m/2);
        return 0;
    }
    printf("%lld",n+(m-2*n)/4);
    
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
    #define lb lower_bound 
    #define ub upper_bound
    #define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define vi vector<int> 
	#define vvi vector<vi>
    #define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
    #define all(c) (c).begin(),(c).end()
    #define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
    
	const int N =1e6;
    
     int mod= 1e9+7;
     int dx[4]={0,0,+1,-1};
     int dy[4]={+1,-1,0,0};
   
   
   
   int digit(int x){
      int  ct=0;
      
      while(x>0){
          ct++;
          x/=10;
      }
      
      return ct;
   }
   
   void solve() {
	      int m,d,cnt=0;
          cin>>m>>d;
          
          rep(i,1,m+1){
              rep(j,1,d+1){
                  if(digit(j)>=2){
                    int num=j;
                      int d1=num%10;
                       num/=10;
                      int d2=num%10;
                      
                      if(d1>=2 && d2>=2 && d1*d2==i)
                         cnt++; 
                  }
              }
          }
          
          
          cout<<cnt<<endl;
       }
   
   
   
      int32_t main() {
	    cool;
	    int t=1;
        //cin>>t;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }


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

using namespace std;

int main()
{

	string s, t;
	cin >> s;
	cin >> t;
	int n = s.length();
	int m = t.length();

	vector<vector<int>>dp(n + 1, vector<int>(m + 1 ,0));

	for (int i = 1; i <= n ; i++) {
		for (int j = 1; j <= m; j++) {
			if (s[i - 1] == t[j - 1]) {
				dp[i][j] = 1 + dp[i - 1][j - 1];
			} else {
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}

	int lMax = dp[n][m];
	//cout << lMax << endl;
	if (lMax == 0) {

		return 0;
	}
	string lcs(lMax , 'a');
	int p1 = n;
	int p2 = m;
	
	while (p1 > 0 && p2 > 0) {
		if (s[p1 - 1] == t[p2 - 1]) {
			lcs[lMax - 1] = s[p1 - 1];
			p1--;
			p2--;
			lMax--;
		} else if (dp[p1 - 1][p2] > dp[p1][p2 - 1]) {
			p1--;
		} else {
			p2--;
		}
	}

	cout << lcs;
	
	return 0;
}	

Measured memory_bytes: 35584
dict={}
cnt=0
n,k=[int(i) for i in input().split()]
a=input().split()
for i in a:
  if i in dict:
    dict[i]+=1
  else:
    dict[i]=1
dict=sorted(dict.items(), key=lambda x: x[1])
for i in range(0,len(dict)-k):
  cnt+=dict[i][1]
print(cnt)

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

using namespace std;
int main() {
    int n;
    set<long long> nums;

    cin >> n;

    for (int i = 0; i < n; i++) {
        long long v;
        cin >> v;
        if (nums.count(v)) {
            nums.erase(v);
        } else {
            nums.insert(v);
        }
    }

    cout << nums.size() << endl;
    return 0;
}


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

int n;
double dp[310][310][310];

double rec(int i, int j, int k){
  if(dp[i][j][k]>=0)return dp[i][j][k];
  if(i==0 && j==0 && k==0)return 0.0;

  double res = 0.0;
  if(i>0)res += rec(i-1,j,k)*i;
  if(j>0)res += rec(i+1,j-1,k)*j;
  if(k>0)res += rec(i,j+1,k-1)*k;
  res += n;
  res *= 1.0/(i+j+k);

  return dp[i][j][k] = res;  
}


int main(){
  cin >> n;
  int a[n];
  int one=0,two=0,three=0;
  rep(i,n){
    cin >> a[i];
    if(a[i]==1) one++;
    else if(a[i]==2) two++;
    else three++;
  }
  memset(dp,-1,sizeof(dp));
  //rep(i,n)rep(j,n)rep(k,n)dp[i][j][k]=-1;
  cout << fixed << setprecision(10) << rec(one, two, three) << endl;

  return 0;
}

Measured memory_bytes: 232960
def main():
    N = int(input())
    F = [
        [int(x) for x in input().split()]
        for _ in range(N)
    ]
    P = [
        [int(x) for x in input().split()]
        for _ in range(N)
    ]

    ans = f(N, F, P)
    print(ans)


def f(N, F, P):
    """
    N=100=10^2
    曜日*AMPM=10
        Fの組合せ=2^10≒1000=10^3
    10^3*10^2=10^5
    """
    ans = -float("inf")
    for x in range(1, 2 ** 10):
        tmp = 0
        for i in range(N):
            c = 0
            for j in range(10):
                # bit onと店営業中の確認
                if x & (2 ** j) and F[i][j]:
                    c += 1
            tmp += P[i][c]

        ans = max(ans, tmp)

    return ans


if __name__ == '__main__':
    main()


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	set<string> dic;
	int n;	cin>>n;
	string com,key;
	while(n--){
		cin>>com>>key;
		if(com=="insert")	dic.insert(key);
		else{
			if(dic.find(key)==dic.end())	cout<<"no"<<endl;
			else 	cout<<"yes"<<endl;
		}	
	}
	return 0;
}
			

Measured memory_bytes: 27816
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <tuple>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;

using ll=long long;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vll> vl2d;
typedef vector <vi> vi2d;
typedef vector <char> vc;
typedef vector <bool> vb;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <char,int> mci;
typedef map <int,int> mii;
typedef map <long,long> ml;
typedef map <string,string> mss;
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define foreach(x,arr) for(auto& x:arr)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define endl '\n' // Normal `cout << endl` flushes the output every time wich hit performance badly
#define INF 1000000000LL
#define MOD 1000000007
#define deb(x) cout<<#x<<": "<<x<<endl;
#define printArray(arr) for(auto x: arr) { cout<<x<<"\n"; }
#define printMatrix(mat) for(auto x: mat) { cout<<" "; printArray(x); cout<<endl; }
#define printMap(mmap) for(auto p: mmap) { cout<< p.first<<": "<<p.second<<endl; }
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define forch(ch,str) for(char& c : str)
#define FILL(a,b) memset(a,b,sizeof(a))
//Swift related stuff
#define append push_back
#define nil nullptr
#define guard(_condition) if (bool(_condition)){}
#define count size()
#define let const auto
#define var auto
#define startsWith(str) rfind(str, 0)
#define prq priority_queue
#define tostr(argument) to_string(argument)
#define alphabet "abcdefghijklmnopqrstuvwxyz"

void join(const vector<string>& v, char c, string& s) {

   s.clear();

   for (vector<string>::const_iterator p = v.begin();
        p != v.end(); ++p) {
      s += *p;
      if (p != v.end() - 1)
        s += c;
   }
}

ll solve(vector<ll> arr, int n) {
    vl2d dp(n, vll(n, 0));
    vll ps(n, 0);
    rep(i, 0, n) {
        ps[i] = arr[i] + (i-1 >= 0 ? ps[i-1] : 0);
    }
    
    
    rep(length, 2, n+1) {
        var start = 0;
        var end = start+length-1;
        while (end < n) {
            ll mn = LONG_MAX;
            rep(mid, start, end) {
                mn = MIN(dp[start][mid]+dp[mid+1][end], mn);
            }
            dp[start][end] = mn + (ps[end]-(start-1 >= 0 ? ps[start-1] : 0));
            start += 1;
            end += 1;
        }
    }
    return dp[0][n-1];
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); // Fast input
    
    int n;
    cin>>n;
    vll arr(n,0);
    rep(i, 0, n) {
        cin>>arr[i];
    }
    cout<<solve(arr, n)<<endl;
    return 0;
}


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

// Preparing for IOI 2018

using namespace std;

const int inf = (int) 1e9 + 7;
const int N = (int) 1e6 + 7;
const double PI = 3.141592653589793238462643;
const double eps = 0.000000001;

#define ok puts("OK");
#define ll long long
#define fr first
#define sc second
#define eb emplace_back
#define pb push_back
#define sz(s) ((int)s.size())
#define all(s) s.begin(), s.end()

char s[N];
ll cnt[1000];
int n; ll ans = 1;


inline void solve () {
	scanf ("%s", s);
	n = strlen(s);
	for (int i = 0; i < n; i++) {
		ans += i - cnt[(int)s[i]];
		cnt[(int)s[i]]++;
	}
	printf ("%lld", ans);
}

int test = 1;

main () {
        // freopen("example.in", "r", stdin); freopen("example.out", "w', stdout);
        // scanf ("%d", &test);
        while (test--) {
                solve();
        }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
signed main(){
    ll n,d;cin>>n>>d;
    ll cnt=0;
    rep(i,n){
        ll x,y;cin>>x>>y;
        if(x*x+y*y<=d*d)cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3592
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();
      int c = scan.nextInt();
      int k = scan.nextInt();
      int count = 0;
      while(a>=b){
        b= b*2;
        count++;
      }
      while(b>=c){
        c=c*2;
        count++;
      }
      if(count <= k){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
        
	}
}

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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/11  Problem: ABC 086 B / Link: http://abc086.contest.atcoder.jp/tasks/abc086_b  ----- */


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


	string a, b; cin >> a >> b;
	string s = a + b;
	auto f = [&]() {
		LL n = stoll(s);
		FOR(i, 1, 10001) {
			LL c = i;
			if (c*c == n)return 1;
		}
		return 0;
	};
	LL ans = f();
	
	
	cout << (ans?"Yes":"No") << "\n";

	return 0;
}


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

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

  string s, t;
  cin >> s >> t;

  reverse(t.begin(), t.end());
  if (s == t) cout << "YES\n";
  else cout << "NO\n";

  return (0);
}


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

using namespace std;

int main()
{
	string s;
	cin >> s;
	if (!(s[0] ^ s[1]) || s[2] ^ s[3] || s[4] ^ s[5])
	{
		cout << "No";
	}
	else
	{
		cout << "Yes";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	int a[3];
	rep(i,3)cin>>a[i];
	sort(a,a+3);
	cout<<a[0]+a[1]<<endl;;
	return 0;
}

Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

k_a = (30 * (h + m/60))/360 * math.pi *2
k_b = (6 * m)/360 * math.pi *2

print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(k_b - k_a)))

Measured memory_bytes: 9448
#include<iostream>
#include<cstdio>
using namespace std;
char z[20]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J'}; 
void zhuan(int n,int m){//printf("n:%d m:%d",n,m);
    if(n==0)return;
    else{
        if(n>0||n%m==0){zhuan(n/m,m);printf("%c",z[n%m]);return;}
        else {zhuan(n/m+1,m);printf("%c",z[-m+n%m]); return;}
    }
}
int main(){
    int n,m=-2;
    scanf("%d",&n);
	if(n==0)cout<<0;
    else zhuan(n,m);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;


void solve()
{
	int a,b,c;
	cin>>a>>b>>c;
	int req=a/b+(a%b!=0);
	cout<<c*req<<endl;
	
}
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
	solve();
    return 0;
}


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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 1e6 + 7;
const int MX = 998244353;
const LL INF = 1LL * MX * MX;

int n;
int cnt[N];

void no(){
	puts("0");
	exit(0);
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i){
		int a;
		scanf("%d", &a);
		cnt[a]++;
		
		if(i == 1 && a != 0)
			no();
	}
	
	if(cnt[0] != 1)
		no();
		
	int ans = 1;
	for(int i = 1; i < n; ++i){
		int prv = cnt[i - 1];
		int cur = cnt[i];
		
		while(cur--)
			ans = (1LL * ans * prv) % MX;
	}
	
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main() {
 int use[100],d[100][100],rn,pn,i,j,to,fr,s1,d1,v1,a,b,c,n;
 for (i=0;i<100;i++) for (j=0;j<100;j++) { d[i][j]=999999999; use[i]=0;}
 cin >> n;
 for (i=0;i<n;i++) {
   cin >> to >> rn; 
   for (j=0;j<rn;j++) { cin >> fr; d[to-1][fr-1]=1; use[to-1]=1; use[fr-1]=1;}
 }
 for (a=0;a<100;a++) for (b=0;b<100;b++) for (c=0;c<100;c++) 
     if (use[a]==1 && use[b]==1 && use[c]==1) d[b][c]=min(d[b][c],d[b][a]+d[a][c]); 
 cin >> pn;
 for (i=0;i<pn;i++) {
   cin >> s1 >> d1 >> v1;
   if (d[s1-1][d1-1]>v1-1) cout << "NA"; else cout << d[s1-1][d1-1]+1;
   cout << endl;
 }
return 0;
 }

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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	int N;
	cin >> N;
	ll ans = 0;
	ans += (N/500)*1000;
	N%=500;
	ans += (N/5)*5;
	cout << ans << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 256
first_input = list(map(lambda x:int(x), input().split(" ")))
second_input = list(map(lambda x:int(x), input().split(" ")))

second_input.sort(reverse=True)
criteria = sum(second_input)/float(4*first_input[1])

count = 0
for i in range(len(second_input)):
    if second_input[i]>=criteria:
        count = count+1
    else:
        break

if count >= first_input[1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <iostream>

int main() {
  long long n, m;
  std::cin >> n >> m;
  long long ans = 0;
  if (n * 2 <= m) {
    ans += n;
    m -= 2 * n;
    n = 0;
  } else {
    n -= m / 2;
    ans += m / 2;
    m = 0;
  }
  if (m > 3) {
    ans += m / 4;
    m /= 4;
  }
  std::cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
ar = Array.new(n) { gets.chomp }
ar.sort!
ar << ""

max_cnt = 0
cnt = 0
prev = ""
ans = []
ar.each do |s|
  if prev == s
    cnt += 1
  else
    if cnt == max_cnt
      ans << prev
    elsif cnt > max_cnt
      max_cnt = cnt
      ans = [prev]
    end
    prev = s
    cnt = 1
  end
end
puts ans


Measured memory_bytes: 21632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k,a[1005],sum=0;

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<k;i++){
		sum+=a[i];
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=998244353;
int n,hs[N],nex[N],t[N<<2];
ll f[N];
struct node
{
    int l,r;
    bool operator<(const node&o)const{return l<o.l;}
}a[N];
void fix(int l,int r,int k,int x,int v)
{
    if(l==r)
    {
        t[k]=max(t[k],v);return;
    }
    int m=l+r>>1;
    if(x<=m) fix(l,m,k<<1,x,v);
    else fix(m+1,r,k<<1|1,x,v);
    t[k]=max(t[k<<1],t[k<<1|1]);
}
int query(int l,int r,int k,int x,int y)
{
    if(r<x||l>y) return 0;
    if(l>=x&&r<=y) return t[k];
    int m=l+r>>1;
    return max(query(l,m,k<<1,x,y),query(m+1,r,k<<1|1,x,y));
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x,y;scanf("%d%d",&x,&y);
        y=x+y-1;
        a[i]={x,y};
        hs[i]=x;
    }
    sort(a+1,a+1+n);
    sort(hs+1,hs+1+n);
    nex[n]=n+1;
    fix(1,n,1,n,nex[n]);
    for(int i=n-1;i>=1;i--)
    {
        int l=lower_bound(hs+1,hs+1+n,a[i].l)-hs,r=upper_bound(hs+1,hs+1+n,a[i].r)-hs-1;
        nex[i]=max(r+1,query(1,n,1,l,r));
        fix(1,n,1,i,nex[i]);
    }
    f[1]=1;
    for(int i=1;i<=n;i++)
    {
        f[i+1]=(f[i+1]+f[i])%mod;
        f[nex[i]]=(f[nex[i]]+f[i])%mod;
    }
    printf("%lld\n",f[n+1]);
}


Measured memory_bytes: 8064