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

string toTernary(int num, int times){
	string ret="";
	while(times--){
		ret+=((num%3)+'0');
		num/=3;
	}
	reverse(ret.begin(),ret.end());
	
	return ret;
}

int main(){
	int n;
	cin >> n;
	int arr[n];
	for(int i=0;i<n;i++)
		cin >> arr[i];
	int till=1,ans=0;
	for(int i=1;i<=n;i++) till*=3;
	vector<int> vect;
	for(int i=0;i<till;i++){
		string s=toTernary(i,n);
		vect.clear();
		for(int j=0;j<n;j++){
			if(s[j]=='0') vect.push_back(arr[j]);
			else if(s[j]=='1') vect.push_back(arr[j]-1);
			else vect.push_back(arr[j]+1);
		}
		bool ok=false;
		for(int j=0;j<n;j++){
			if(vect[j]%2==0) ok=true;
		}
		if(ok) ans++;
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<ll> H(n);
  rep(i,n) cin >> H[i];
  vector<vector<int>> X(n,vector<int>(0));
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--; b--;
    X[a].push_back(b);
    X[b].push_back(a);
  }
  int tot = 0;
  rep(i,n){
    bool ans = true;
    for(const auto&it:X[i]){
      if(H[i]<=H[it])ans = false;
    }
    if(ans) tot++;
  }
  cout << tot << endl;

}


Measured memory_bytes: 9072
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> m;
  m.push_back(0);
  int tmp_max = m[0];
  int ans = 0;
  for(int i = 0; i < n; i++){
    int tmp; cin >> tmp;
    m.push_back(tmp);
    if(tmp_max <= m.back()){
      ans += 1;
      tmp_max = m.back();
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
s = gets.chomp
n = s.size

to = (n-1)/2
from = (n+3)/2

if s == s.reverse && s[0..to-1] == s[0..to-1].reverse && s[(from-1)..n-1] == s[(from-1)..n-1].reverse
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 1788
N = int(input())
p = 10 ** 9 + 7
DP = [[0 for j in range(16)] for i in range(N)]
for i in range(16):
  DP[1][i] = 1
for i in range(2, N):
  DP[i][0] = (DP[i - 1][0] + DP[i - 1][4] + DP[i - 1][8] + DP[i - 1][12]) % p #0:AA
  DP[i][1] = (DP[i - 1][0] + DP[i - 1][4] + DP[i - 1][12]) % p #1:AC
  DP[i][2] = (DP[i - 1][0] + DP[i - 1][4] + DP[i - 1][8] + DP[i - 1][12]) % p #2:AG
  DP[i][3] = (DP[i - 1][0] + DP[i - 1][4] + DP[i - 1][8] + DP[i - 1][12]) % p #3:AT
  DP[i][4] = (DP[i - 1][1] + DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]) % p #4:CA
  DP[i][5] = (DP[i - 1][1] + DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]) % p #5:CC
  DP[i][6] = (DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]) % p #6:CG
  DP[i][7] = (DP[i - 1][1] + DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]) % p #7:CT
  DP[i][8] = (DP[i - 1][2] + DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14]) % p #8:GA
  DP[i][9] = (DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14] - DP[i - 2][2] - DP[i - 2][3]) % p #9:GC
  DP[i][10] = (DP[i - 1][2] + DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14]) % p #10:GG
  DP[i][11] = (DP[i - 1][2] + DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14]) % p #11:GT
  DP[i][12] = (DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15]) % p #12:TA
  DP[i][13] = (DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15] - DP[i - 2][2]) % p #13:TC
  DP[i][14] = (DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15]) % p #14:TG
  DP[i][15] = (DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15]) % p #15:TT
print(sum(DP[N - 1]) % p)

Measured memory_bytes: 3276
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int pow[]={0,0,10,100,1000,10000,100000};
int hoge[]={0,0,0,90,990,9990,99990};

signed main(){
  int n;cin>>n;
  vector<vector<int>> map(10,vector<int> (10,0));
  int keta=0;
  int buf=n;
  int top,last;
  last=buf%10;
  while(buf>0){
    keta++;
    if(buf<10)top=buf;
    buf/=10;
  }
  for(int i=n;i>0;i--){
    buf=i;
    last=buf%10;
    keta=0;
  while(buf>0){
    keta++;
    if(buf<10)top=buf;
    buf/=10;
  }
  //if(last*pow[keta]+top>n)continue;
  map[top][last]++;
  }
  int res=0;
  rep1(i,9){
      rep1(j,9){
          res+=map[i][j]*map[j][i];
          //cout<<map[i][j]<<" ";
      }
      //cout<<endl;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
def LI():
    return list(map(int, input().split()))


N = int(input())
count = 0
ans = "No"
for i in range(N):
    a, b = LI()
    if a == b:
        count += 1
        if count == 3:
            ans = "Yes"
            break
    else:
        count = 0
print(ans)


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

int main() {
  double W,H,x,y;
  cin>>W>>H>>x>>y;
  double ans=W*H/2;
  int met=0;
  long ver=W-x*2;
  long hol=H-y*2;
  if(ver==0 && hol==0) met=1;
  cout<<ans<<" "<<met<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

istringstream lcin;
void rl()
{
    string s;
    getline(cin, s);
    lcin = istringstream(s);
}
// build: ctrl + f9

// run: shift + f10
// debug: shift + f9
// sanitize: shift + f11

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    double R;
    cin >> R;
    double circ = 2.0*M_PI*R; 
    cout << fixed << setprecision(20) << circ << endl;
}

Measured memory_bytes: 3764
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
#define FOR(x, to) for(x=0; x<(to); x++)

int main(){
    int R, G, B, N, i, count = 0;
    vector<int> rgb(3,0);
    cin >> R >> G >> B >> N;
    rgb[0] = N / R;
    rgb[1] = N / G;
    rgb[2] = N / B;

    for(int i=rgb[0]; i>=0; i--){
        if(i * R == N) {
            count++;
            continue;
        }
        for(int j=rgb[1]; j>=0; j--){
            if(i * R + j * G == N){
                count++;
                continue;
            }else if(i * R + j * G > N)
                continue;
            if((N - (i * R + j * G)) % B == 0){
                count++;
            }
            
        }
    }
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();

        String x = in.nextToken();
        String y = in.nextToken();

        int compare = x.compareTo(y);
        if (compare < 0) {
            //x is smaller
            System.out.println("<");
        }
        else if (compare > 0) {
            //x is larger
            System.out.println(">");
        }
        else {
            //x is equal to y
            System.out.println("=");
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

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

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

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


Measured memory_bytes: 21332
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <sstream>
#include <vector>
#include <cstring>
#include <map>
#include <cassert>
using namespace std;

int dp[31][1<<16];

int main(){
	int n,c;
	while(cin >> n >> c  && n){
		vector<int> a(n),b(c);
		for(int i = 0 ; i < n ; i++){	
			int t = 0;
			for(int j = 0 ; j < 16 ; j++){
				int p; cin >> p; t = t * 2 + p;
			}
			a[i] = t;
		}
		
		for(int i = 0 ; i < c ; i++){	
			int t = 0;
			for(int j = 0 ; j < 16 ; j++){
				int p; cin >> p; t = t * 2 + p;
			}
			b[i] = t;
		}
		for(int i = 0 ; i < 31 ; i++)
			for(int j = 0 ; j < (1<<16) ; j++)
				dp[i][j] = -1e9;
		dp[0][0] = 0;
		for(int i = 0 ; i < n ; i++){
			for(int j = 0 ; j < (1<<16) ; j++){
				if( dp[i][j] >= 0 ){
					for(int k = 0 ; k < c ; k++){
						dp[i+1][(j|a[i])&~(b[k])] = 
							max(dp[i+1][(j|a[i])&~(b[k])],dp[i][j]+__builtin_popcount((j|a[i])&(b[k])) );

					}
				}
			}
		}
		int ans = 0;
		for(int j = 0 ; j < (1<<16) ; j++)
			ans = max( ans , dp[n][j] );
		cout << ans << endl;
	}
}

Measured memory_bytes: 9132
import heapq, math, sys

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
maxA = A[0]
pre = -1
while len(A) != pre:
    if len(A) == 0:
        print(math.ceil(maxA))
        sys.exit()
    pre = len(A)
    meanA = math.ceil(sum(A)/(len(A)+K))
    for i, a in enumerate(A):
        if a <= meanA:
            A = A[:i]
            break


cuts = [0]*(i+1)
meanA = (sum(A)/(len(A)+K))
for i, a in enumerate(A):
    cut_at_least = (math.floor(a/meanA) - 1)
    cuts[i] = cut_at_least
    K -= cut_at_least
hq = [(-a/(cut+1), i) for i, (a, cut) in enumerate(zip(A, cuts))]
heapq.heapify(hq)
lenhq = len(hq)
for k in range(K):
    l, i = heapq.heappop(hq)
    cuts[i] += 1
    if k <= N:
        heapq.heappush(hq, (-A[i]/(cuts[i]+1), i))
l, i = heapq.heappop(hq)
print(math.ceil(-l))


Measured memory_bytes: 113372
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
}

const long long mod = 1e9 + 7;
long long  inv[200000+5];
long long  fac[200000 + 5];


long long  C(int n, int m) {
	return fac[n] * inv[m] % mod*inv[n - m] % mod;
}


void init() {
	inv[0] = fac[0] = 1;
	inv[1] = 1;
	for (int i = 1; i<=200000; i++) {
		fac[i] = fac[i - 1] * i%mod;
	}
	inv[1] = 1;
	for (int i = 2; i<=200000; i++) {
		inv[i] = (long long )(mod - mod / i)*inv[mod%i] % mod;
	}
	inv[0] = 1;
	for (int i = 1; i<=200000; i++) {
		inv[i] = inv[i - 1] * inv[i] % mod;
	}
}

long long n, m,k;
long long ans = 0;

int main()
{
	init();
	cin >> n >> m>>k;
	for (long long i = 1; i <= n - 1; i++)
		ans = (ans + i*(n - i) % mod*m%mod*m%mod) % mod;
	for (long long i = 1; i <= m - 1; i++)
		ans = (ans + i*(m - i) % mod*n%mod*n%mod) % mod;

	ans = ans * C(n*m - 2, k - 2)%mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
  char C1[10000][2];
  char C2[10000][2];
  int n,i,j;
  scanf("%d",&n);
  /*
  for(i=0;i<n;i++){
    scanf("%c%d",&C[i].mark,&C[i].num);  
  }
  */
  for(i=0;i<n;i++){
    scanf("%s",&C1[i]);  
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<2;j++){
     C2[i][j]= C1[i][j]; 
    }
  }
    
  /*
  for(i=0;i<n;i++){
    for(j=0;j<2;j++){
      printf("%c",C[i][j]);  
    }
    printf(" ");
  }
  */
  BubbleSort(C2,n);
  printf("Stable\n");
  
  SelectionSort(C1,n);
  if(isStable(C1,C2,n) == 0) printf("Stable\n");
  else  printf("Not stable\n");
 
 


}

int BubbleSort(char A[10000][2],int n){
  int i,j;
  char c_tmp;
  int i_tmp;
  int judge=0;
  for(i=0;i<n;i++){
    for(j=n-1; j>i; j--){
      if(A[j][1] < A[j-1][1]){
	c_tmp = A[j-1][0];
	A[j-1][0] = A[j][0];
	A[j][0] = c_tmp;

	i_tmp = A[j-1][1];
	A[j-1][1] = A[j][1];
	A[j][1] = i_tmp;
       
      }
    }
  }
 
  for(i=0;i<n;i++){
    for(j=0;j<2;j++){
      printf("%c",A[i][j]);  
    }
    if(i!=(n-1))printf(" ");
  }
  printf("\n");
  return 0;
}

int SelectionSort(char A[10000][2],int n){
  int i,j,minj;
  char c_tmp;
  int i_tmp;
  int judge = 0;

  
  for(i=0;i<n;i++){
    minj = i;
    
    for(j = i ;j < n ;j++){
      if(A[j][1] < A[minj][1]){
	minj = j;
      }
    }
 
    c_tmp = A[minj][0];
   
    A[minj][0] = A[i][0];
    A[i][0] =c_tmp;
      
    i_tmp = A[minj][1];
    A[minj][1] = A[i][1];
    A[i][1] = i_tmp;


  }
  
  
  
  for(i=0;i<n;i++){
    for(j=0;j<2;j++){
      printf("%c",A[i][j]);  
    }
    if(i!=(n-1)) printf(" ");
  }
  printf("\n");
  return 0;
  
}

int isStable(char in[10000][2],char out[10000][2], int n){
  int a,b,i,j;
  for(i=0;i<n;i++){
    if( in[i][0] != out[i][0]){
  
	return 1;
      }
  }
  return 0;
}



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

class A
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var r = new List<int>();
		var h = Read();
		var n = h[0];

		var uf = new UF(n);

		for (int i = 0; i < h[1]; i++)
		{
			var q = Read();
			if (q[0] == 0)
				uf.Unite(q[1], q[2]);
			else
				r.Add(uf.AreUnited(q[1], q[2]) ? 1 : 0);
		}
		Console.WriteLine(string.Join("\n", r));
	}
}

class UF
{
	int[] p;
	public UF(int n) { p = Enumerable.Range(0, n).ToArray(); }

	public void Unite(int a, int b) { if (!AreUnited(a, b)) p[p[b]] = p[a]; }
	public bool AreUnited(int a, int b) => GetRoot(a) == GetRoot(b);
	public int GetRoot(int a) => p[a] == a ? a : p[a] = GetRoot(p[a]);
}


Measured memory_bytes: 43088
#pragma GCC optimize("O3")
 
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pi;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz size
// #define f first
// #define s second
ll s[2001];
ll t[2001];
ll dp[2001][2001];
 
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll mod = 1000000007;
 
    ll n, m;
    cin >> n >> m;
    FOR(i,1,n+1)
        cin >> s[i];
    FOR(i,1,m+1)
        cin >> t[i];
    dp[0][0] = 1;
    FOR(i,0,n+1)
    {
        FOR(j,0,m+1)
        {
            if(i==0 || j==0)
                dp[i][j] = 0;
            else
            {
                if(s[i] == t[j])
                    dp[i][j] = (dp[i-1][j]+dp[i][j-1]+1+mod)%mod;
                else
                    dp[i][j] = (dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+mod)%mod;
            }
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }
    cout << (dp[n][m]+1)%mod;
 
    return 0;
}

Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int A, B;
  cin >> A >> B;
  string U;
  cin >> U;
  if (U == S) A--;
  if (U == T) B--;
  cout << A << " " << B << "\n";
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(30);
#define ll long long
#define pi 3.14159265359
using namespace std;

int main()
{
    IOS;
    ll n,d,x,y,s,c=0;
    cin>>n>>d;
    while(n--){
        cin>>x>>y;
        s=x*x+y*y;
        if(s<=d*d) c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}

signed main() {
	string s;
	int sum = 0;
	cin >> s;
	rep(i, s.size()) {
		if (s[i] == 'o')sum++;
	}
	if (sum + (15 - s.size()) >= 8) {
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
}


Measured memory_bytes: 256
import sys
from sys import exit
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(10**7)

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

S = input()
T = input()
ans = len(T)
for i in range(len(S) - len(T) + 1):
    num = 0
    for j, x in enumerate(S[i:i+len(T)]):
        if T[j] != x:
            num += 1
    ans = min(ans, num)
print(ans)


Measured memory_bytes: 9516
#include <iostream>

int main(void){
  char a[200000];
  char b[200000];
  int m=0;
  
  for(int i=0;i<200000;i++){
    a[i]=0;
    b[i]=0;
  }
  
  std::cin >> a;
  std::cin >> b;

  int n = sizeof(a);
  for (int i=0;i<n;i++){
    if (a[i]!=b[i]) m++;
  }
  std::cout << m;
  
  return(0);
}

Measured memory_bytes: 4024
using System;
using System.Linq;

class prog{
  static void Main(){
    int N = int.Parse(Console.ReadLine());
    int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int T = input[0];
    int A = input[1];
    int[] H = Console.ReadLine().Split().Select(int.Parse).ToArray();
    
    double[] abs = new double[N];
    for(int i = 0; i < N; i++){
      abs[i] = Math.Abs(A - T + 0.006 * H[i]);
    }
    
    double min = abs[0];
    int ans = 1;
    for(int i = 0; i < N; i++){
      if(abs[i] < min){
        min = abs[i];
        ans = i + 1;
      }
    }
    
    Console.WriteLine(ans);
  }
}

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

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




Measured memory_bytes: 3100
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const int INF = 2000000000;

    ll N,M;
    ll A,B,C;
    std::string S,T;
    bool F=true;
    ll ans=0;
    ll a[10010],b[10010];
    //解説 他ソース(beet)解読 合計操作回数に注目する一般的なテクニック！！！！！
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N;
    REP(i,N){cin>>a[i];A-=a[i];}
    REP(i,N){cin>>b[i];A+=b[i];}
    REP(i,N){
        if(a[i]<b[i]){
            B+=(b[i]-a[i])/2;
        }
        if(a[i]>b[i]){B-=(a[i]-b[i]);}
    }
    cout<<(B>=0?"Yes":"No")<<endl;
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  char A, B;
  cin >> A >> B;
  if (A == B) {
    cout << "=" << endl;
  } else if (A > B) {
    cout << ">" << endl;
  } else {
    cout << "<" << endl;
  }

  return 0;
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> vec(n, 0), ans(n, 0);
	for(int i = 0; i < n; ++i){
		cin>>vec[i];
		ans[i] = vec[i];
	}
	sort(ans.begin(), ans.end());
	vector<int>::reverse_iterator rit = ans.rbegin();
	int r = *rit;
	rit++;
	int p = *rit;
	for(int i = 0; i < n; ++i){
		if(vec[i] == r)cout<<p<<endl;
		else cout<<r<<endl;
	}
	return 0;
}


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

int main() {
  char b;
  cin >> b;
  if (b == 'A') cout << 'T' << endl;
  else if (b == 'T') cout << 'A' << endl;
  else if (b == 'C') cout << 'G' << endl;
  else cout << 'C' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int flag=0,i;
	char a[3];
	cin>>a;
	for(i=0;i<3;i++)
		if(a[i]=='A')
			flag++;
	if(flag==0||flag==3)
		printf("No\n");
	else
		printf("Yes\n");
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

int main() {
    int n,ans=0; string s;
    cin>>n>>s;

    for (int i=0;i<n-2;i++) {
        if(s.substr(i,3)=="ABC"){
            ans++;
        }
    }

    cout<<ans<<endl;
}



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

int main(){
#ifdef _DEBUG
	freopen("in" , "r", stdin );
	freopen("out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	vector<char> s = {'a', 'e', 'i', 'o', 'u'};
	char c; cin >> c;
	if(find(s.begin(), s.end(), c) != s.end()) cout << "vowel\n";
	else cout << "consonant\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans_x=-1,ans_y=-1,ans_z=-1;
int main(){
    ll n,y,flag=1;
    cin >> n >> y;
    y/=1000;
    for(int i=min(n,y/10);i>=0;i--){
      if(i*10+(n-i)*5<y)break;
        for(int j=n-i;j>=0;j--){
            if(9*i+4*j+n==y){
                ans_x=i;
                ans_y=j;
                ans_z=n-i-j;
            }
        }
    }
    cout << ans_x << " " << ans_y << " " << ans_z << endl;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;

public class Main {

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

	void run() {
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		if(A+B==15) {
			pln("+");
		}else if(A*B==15) {
			pln("*");
		}else {
			pln("x");
		}
	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

	static int lcm(int a, int b) {
		return a * b / gcd(a, b);
	}

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


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

using namespace std;

int main() {
  	int A, B, M, x, y, c;
  	cin >> A >> B >> M;
  	vector<int> a(A);
  	vector<int> b(B);
  	int min_a = 1e6, min_b = 1e6;
  	for (int i=0; i<A; i++) {
    	cin >> a[i];
      	min_a = min(min_a, a[i]);
    }
    for (int i=0; i<B; i++) {
    	cin >> b[i];
      	min_b = min(min_b, b[i]);
    }
  	int ans = min_a + min_b;
  	for (int i=0; i<M; i++) {
    	cin >> x >> y >> c;
      	ans = min(ans, a[x-1]+b[y-1]-c);
    }
  	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

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

        int k = sc.nextInt();
        char[] s = sc.next().toCharArray();

        if (s.length <= k) {
            System.out.println(s);
        } else {
            System.out.println(new String(Arrays.copyOf(s, k)) + "...");
        }
    }
}

Measured memory_bytes: 38532
l = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776,46656, 59049]
n = int(input())
ans = [10**9 for _ in range(n+1)]
ans[0] = 0

for i in range(n):
    for j in l:
        if i + j <= n:
            ans[i+j] = min(ans[i] + 1,ans[i+j])
        
print(ans[n])



Measured memory_bytes: 3864
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

int g[16][16],n,x,y,now;

void func2(void);

void func1(void){
  if(x>=n) {
    x=0;
  }

  if(x<0){
    x=n-1;
  }

  if(y>=n){
    y=0;
  }

  if(g[y][x]>0)func2();
}

void func2(void){
  if(g[y][x]>0){
    x--;
    y++;
  }
  
  if(x>=n || x<0 || y>=n)func1();
}

int main(void){

  while(cin >> n,n){
    for(int i=0;i<16;i++)
      for(int j=0;j<16;j++)
	g[i][j]=0;

      x=n/2;
      y=n/2+1;
    g[y][x]=1;

    now=2;

    for(int i=1;i<n*n;i++,now++){
      x++;
      y++;
      if(x>=n || x<0 || y>=n)func1();
	 if(g[y][x]>0)func2();
	 g[y][x]=now;
    }

      for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	  printf("%4d",g[i][j]);
	}
	cout << endl;
      }
    }
    
  return 0;
}

Measured memory_bytes: 1192
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int n;

void dfs(ll cur,int use,int &cnt){
  if(cur>n) return;
  if(use==0b111) cnt++;
  dfs(cur*10+7, use | 0b001 , cnt);
  dfs(cur*10+5, use | 0b010 , cnt);
  dfs(cur*10+3, use | 0b100 , cnt);
}

int main(){
  cin>>n;
  
  int res=0;
  dfs(0,0,res);  
  cout<<res<<endl;
  
  return 0;
}

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

#define Re real()
#define Im imag()
using namespace std;

typedef complex<double> Point;
Point P[50050];
int n;
double ans;

double cross(const Point& a, const Point& b)
{
    return (conj(a) * b).Im;
}

int main()
{
    while(~scanf("%d", &n))
    {
        for(int i = 0; i < n; i++)
        {
            double tx, ty;
            scanf("%lf%lf", &tx, &ty);
            P[i] = Point(tx, ty);
        }
        ans = 0;
        for(int i=0;i<n;i++)
            ans += cross(P[i], P[(i+1)%n])/2.0;
        printf("%.1f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
 
int main(){
int a, b, c, d;
  cin >> b >> a >> d >> c;
  while(1 > 0){
    d = d - a;
    if(d <= 0){
      cout << "Yes" << endl;
      break;
    }
    b = b - c;
    if(b <= 0){
    cout << "No" << endl;
    break;
    }
  }
}

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

#define N 2020
typedef long long ll;

int n;
ll a[N];
char s[N];
ll pos[66];

int main() {
    int T;
    scanf("%d", &T);
    while (T --) {
        scanf("%d", &n); memset(pos, -1, sizeof pos);
        for (int i = 1; i <= n; i ++) scanf("%lld", &a[i]); scanf("%s", s + 1);
        int ans = 0;
        for (int i = n; i >= 1; i --) {
            ll x = a[i];
            int k;
            for (k = 60; k >= 0; k --) if (x >> k & 1) {
                if (pos[k] < 0) break;
                else x ^= pos[k];
            }
            if (k < 0) continue;
            if (s[i] == '1') ans = 1;
            else pos[k] = x;
        }
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 3696
#include<cstdio>

int main(void){
	int n, u, k, v;
	scanf("%d", &n);
	int a[n+1][n+1];
	for (int row = 1; row <= n; ++row) {
		for (int column = 1; column <= n; ++column)
			a[row][column] = 0;
	}
	for (int vertexi = 0; vertexi < n; ++vertexi) {
		scanf("%d %d", &u, &k);
		for (int outi = 0; outi < k; ++outi) {
			scanf("%d", &v);
			a[u][v] = 1;
		}
	}
	for (int row = 1; row <= n; ++row) {
		for (int column = 1; column <= n; ++column)	{
			if(column > 1)
				printf(" ");
			printf("%d", a[row][column]);
		}
		printf("\n");
	}
	return 0;
}

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

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

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

Measured memory_bytes: 9212
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

int main() {
	ll N, M;
	cin >> N >> M;
	string S;
	cin >> S;
	struct Cell {
		ll idx = 0;
		ll cost = 0;
		bool operator<(const Cell& rhs) const {
			return cost < rhs.cost || (cost == rhs.cost && idx < rhs.idx);
		}
	};
	vector<Cell> next(N);
	set<Cell> available;
	deque<Cell> available_deq;
	available.insert(Cell{N, 0});
	available_deq.push_front(Cell{N, 0});
	rrep(i,N,0) {
		if (available.empty()) {
			cout << -1 << endl;
			return 0;
		}
		if (S[i] == '0') {
			next[i] = *available.begin();
			Cell cell{i, next[i].cost+1};
			available.insert(cell);
			available_deq.push_front(cell);
		}
		while (!available_deq.empty() && available_deq.back().idx - i >= M) {
			available.erase(available.find(available_deq.back()));
			available_deq.pop_back();
		}
	}
	ll i = 0;
	while (true) {
		cout << next[i].idx - i;
		i = next[i].idx;
		if (i != N) {
			cout << " ";
		} else {
			break;
		}
	}
}


Measured memory_bytes: 6272
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
const int mo = 1e9 + 7;
typedef long long ll;
ll a,b;
const int sz=2e5+10;
map<ll,ll> mp;
typedef pair<ll,ll> P;
vector<P> v;
ll ans=0;
void solve()
{
    rep(i,a)
    {
        int c;cin>>c;
        mp[c]++;
    }
    for(map<ll,ll>::iterator it=mp.begin();it!=mp.end();it++)v.emplace_back(make_pair(it->second,it->first));
    if(v.size()>b)
    {
        sort(begin(v),end(v),[&](P a,P b)
        {
            return a.first<b.first;
        });
        for(int i=0;i<v.size()-b;i++)ans+=v[i].first;
    }
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>a>>b;
    solve();
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 17776
/*
                                             ::                     ::
                                             ':                     :
                                              :.                    :
                                           ;' ::                   ::  '
                                          .'  ';                   ;'  '.
                                         ::    :;                 ;:    ::
                                         ;      :;.             ,;:     ::
                                         :;      :;:           ,;"      ::
                                         ::.      ':;  ..,.;  ;:'     ,.;:
                                          "'"...   '::,::::: ;:   .;.;""'
                                              '"""....;:::::;,;.;"""
                                          .:::.....'"':::::::'",...;::::;.
                                         ;:' '""'"";.,;:::::;.'""""""  ':;
                                        ::'         ;::;:::;::..         :;
                                       ::         ,;:::::::::::;:..       ::
                                       ;'     ,;;:;::::::::::::::;";..    ':.
                                      ::     ;:"  ::::::"""'::::::  ":     ::
                                       :.    ::   ::::::;  :::::::   :     ;
                                        ;    ::   :::::::  :::::::   :    ;
                                         '   ::   ::::::....:::::'  ,:   '
                                          '  ::    :::::::::::::"   ::
                                             ::     ':::::::::"'    ::
                                             ':       """""""'      ::
                                              ::                   ;:
                                              ':;                 ;:"


                                                     P_r_A_d_Y
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
void cs(int &x)
{
    cout << "Case #" << x << ": ";
}
bool cmp(string a, string b)
{
    return a + b < b + a;
}

int32_t main()
{
    fastIO;
    // int t; cin >> t;
    // int x = 1;
    // while (t--)
    // {

        int n,m;
        cin>>n>>m;
        //vector<pair<int,int>>v(m);

        int i=1,j=m+1;
        int i1=m + 2;
        int j1=2*m + 1;

        while(1)
        {
            if(i<j)
                {cout<<i<<" "<<j<<endl;i++;j--;}
            else if(i1<j1)
                {cout<<i1<<" "<<j1<<endl;i1++;j1--;}
            else
                break;
        }

        

    //}
    return 0;
}


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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    int n = s.size();

    vector<int> erase(n), eraser(n), dream(n), dreamer(n);

    for (int i = 0; i < n; ++i) {
        if (i + 5 <= n && s.substr(i, 5) == "erase")
            erase[i] = 1;
        if (i + 6 <= n && s.substr(i, 6) == "eraser")
            eraser[i] = 1;
        if (i + 5 <= n && s.substr(i, 5) == "dream")
            dream[i] = 1;
        if (i + 7 <= n && s.substr(i, 7) == "dreamer")
            dreamer[i] = 1;
    }
    vector<int> can(n);
    for (int i = n - 1; i >= 0; --i) {
        if (dream[i] && (i + 5 == n || can[i + 5]))
            can[i] = 1;
        if (dreamer[i] && (i + 7 == n || can[i + 7]))
            can[i] = 1;
        if (erase[i] && (i + 5 == n || can[i + 5]))
            can[i] = 1;
        if (eraser[i] && (i + 6 == n || can[i + 6]))
            can[i] = 1;
    }
    if (can[0])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 7428
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

#define REP(i,n) for(int i=0;i<n;i++)
#define llong long long

using namespace std;

int main(){

	int a, b, cnt = 0;
	
	cin >> a >> b;

	for (int i = a; i <= b; i++) {
		
		if (to_string(i).at(4) == to_string(i).at(0) && to_string(i).at(3) == to_string(i).at(1))
			cnt++;

	}

	cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	c := make([]string, h)
	for i := range c {
		fmt.Scan(&c[i])
	}

	for _, ci := range c {
		fmt.Println(ci)
		fmt.Println(ci)
	}

}


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

int main() {
    int shift;
    string s;
    cin>>shift;
    cin>>s;
    int n=s.length();
    int m;
    for(int i=0;i<n;i++){
        char c=s[i];
        m=int(c)-int('A');
        s[i]=char(((m+shift)%26)+int('A'));
    }
    cout<<s;
	return 0;
}


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

int main(void)
{
    int x = 0;
    for (int i = 0; i < 10000; i++){
        cin >> x;
        if (x != 0) {
            cout << "Case " << i+1 << ": " <<  x << endl;
        } else{
            break;
        }
    }
}


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

int n, m;
stack<int> S;
vector<int> V[100000];
int color[100000];

void dfs(int i, int id){
    S.push(i);
    color[i] = id;

    while(!S.empty()){
        int u = S.top();
        S.pop();
        for(int i=0; i<V[u].size(); i++){
            int v = V[u][i];
            if(color[v]==-1){
                color[v] = id;
                S.push(v);
            }
        }
    }
}

void dfs_init(){

    int id = 1; //グラフの識別
    for(int i=0; i<n; i++){
        color[i] = -1;
    }
    for(int i=0; i<n; i++){
        if(color[i]==-1) dfs(i, id++);
    }
}

int main(){

    cin >> n >> m;

    for(int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        V[a].push_back(b);
        V[b].push_back(a);
    }

    dfs_init();

    int q;
    cin >> q;
    for(int i=0; i<q; i++){
    int x, y;
    cin >> x >> y;
    if(color[x]==color[y]) cout << "yes" << endl;
    else cout << "no" << endl;
    }

    return 0;
}


Measured memory_bytes: 8992
#include"bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){

    fast
	char c;
	cin>>c;
	cout<<(isupper(c) ? 'A' : 'a')<<endl;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<time.h>
#include<assert.h>
#include<iostream>
using namespace std;
typedef long long LL;
typedef pair<int,int>pi;
const int mod=924844033;
int n,K;
int dp[2][2020][4];
int fac[2020];
int is[2020];
inline void up(int &x,int y){
	x+=y;if(x>=mod)x-=mod;
}
int main(){
	scanf("%d%d",&n,&K);
	fac[0]=fac[1]=1;
	for(int i=2;i<=n;i++)fac[i]=1LL*fac[i-1]*i%mod;
	dp[0][0][0]=1;
	int cs=0;
	int fg=n/K;
	for(int i=0,cur=0;i<K;i++){
		is[cur]=1;
		cur+=(n-i)/K+((n-i)%K!=0);
	}
	is[n]=1;
	for(int i=0;i<n;i++,cs^=1){
		memset(dp[cs^1],0,sizeof dp[cs^1]);
		for(int j=0;j<=n;j++)
		for(int mask=0;mask<4;mask++){
			if(!dp[cs][j][mask])continue;
			int w=dp[cs][j][mask];
			bool canbef=(!is[i])&&(~mask&1);
			bool cannxt=(!is[i+1]);
			up(dp[cs^1][j][mask>>1],w);
			if(canbef){
				up(dp[cs^1][j+1][mask>>1],w);
			}
			if(cannxt){
				up(dp[cs^1][j+1][mask>>1|2],w);
			}
		}
	}
	int ans=0;
	for(int j=0;j<=n;j++)
	for(int mask=0;mask<4;mask++){
		int w=dp[cs][j][mask];
		if(!w)continue;
		if(~j&1)up(ans,1LL*w*fac[n-j]%mod);
		else up(ans,(1LL*-w*fac[n-j]%mod+mod)%mod);
	}
	printf("%d\n",ans);
	return 0;
}


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

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

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<vector<ll>> g(n);
    for (ll i = 0; i < n - 1; i++)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    ll ans = k;
    vector<bool> seen(n, false);
    stack<ll> st;
    st.push(0);
    while (st.size())
    {
        ll t = st.top();
        st.pop();
        seen[t] = true;
        ll cnt = 0;
        for (auto v : g[t])
        {
            if (seen[v])
            {
                continue;
            }
            st.push(v);
            if (t == 0)
            {
                (ans *= (k - 1 - cnt)) %= MOD;
            }
            else
            {
                (ans *= (k - 2 - cnt)) %= MOD;
            }
            cnt++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int a[100005], f[100005];

int solve(int n) {
	if (n == 1) return abs(a[1] - a[0]);
	if (n == 2) return min(abs(a[2] - a[0]), abs(a[2] - a[1]) + solve(1));
	if (f[n] != -1) return f[n];
	return f[n] = min(abs(a[n] - a[n - 2]) + solve(n - 2), abs(a[n] - a[n - 1]) + solve(n - 1));
}

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

Measured memory_bytes: 4096