akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
 int L, R, D, ans = 0;
  scanf("%d %d %d", &L, &R, &D);
  for (int i = 1; i <= 100; ++i) {
    if (i * D >= L && i * D <= R) ++ans;
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 1736
#include<stdio.h>
int main()
{
	int str[3],i,j,a,b,c,buf;
		scanf("%d%d%d",&a,&b,&c);
		str[0] = a;
		str[1] = b;
		str[2] = c;
	for(i=0;i<3;i++)
	{
		for(j=0;j<3-1;j++)
		{
			if(str[j]>str[j+1])
			{
				buf=str[j];
				str[j]=str[j+1];
				str[j+1]=buf;
			}
		}
	}
	printf("%d %d %d\n",str[0],str[1],str[2]);
	return 0;
}

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

ll dp[10005][105][2][2];         // dp[x][y][a][b], using (x and y) to get b from a
int N;
string s;
int MOD;
int mod=int(1e9)+7;
ll fun(int idx, int d, int zero , int tight){
    if(idx==N){
        if(d==0 and zero==1) return 1;
        return 0;
    }
    if(dp[idx][d][zero][tight]!=-1) return dp[idx][d][zero][tight];
    ll ans=0;
    int ulim=9;
    if(tight) ulim=s[idx]-'0';
    for(int i=0;i<=ulim;i++){
        ans+=fun(idx+1,(d+i)%MOD,(zero or i!=0), (tight and i==ulim)?1:0)%mod;
    }
    return dp[idx][d][zero][tight]=ans%mod;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string k;
    cin>>k;
    int d;
    cin>>d;
    MOD=d;
    s=k;
    N=s.size();
    memset(dp,-1,sizeof(dp));
    cout<<fun(0,0,0,1)<<"\n";
}

Measured memory_bytes: 33920
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int x=0;
    for(int i=0;i<n;i++){
        if(s[i]!=t[i])x++;
    }
    cout<<x;
    return 0;
}

Measured memory_bytes: 3796
import java.io.*;
import java.util.*;
 
 
public class Main {
	public static void main(String[] args) throws Exception {
		MScanner sc=new MScanner(System.in);
		//MScanner sc=new MScanner("portals.in");
		PrintWriter pw=new PrintWriter(System.out);
		int n=sc.nextInt();
		int[]a=new int[n],b=new int[n],c=new int[n-1];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt()-1;
		}
		for(int i=0;i<n;i++) {
			b[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++) {
			c[i]=sc.nextInt();
		}
		int prev=-7;int sum=0;
		for(int i=0;i<n;i++) {
			sum+=b[a[i]];
			if(a[i]==prev+1) {
				sum+=c[prev];
			}
			prev=a[i];
		}
		pw.println(sum);
		pw.flush();
	}
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];

    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    
    cout << s.size() << endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<vector<int>> A(N,vector<int>(N-1));
    int loop,loop2;
    for(loop=0;loop<N;loop++){
        for(loop2=0;loop2<N-1;loop2++){
            cin >> A[loop][loop2];
        }
    }
    vector<int> prog(N,0);
    vector<int> done(N,0);
    vector<int> doneAll(N,0);
    int progCt=N,worked;
    int ans=0;
    auto t = chrono::system_clock::now();
    while(progCt){
        if(std::chrono::duration_cast<std::chrono::milliseconds>(chrono::system_clock::now() - t).count() > 1700){
            ans = N * (N - 1) / 2;
            break;
        }
        ans++;
        done=doneAll;
        worked=0;
        for(loop=0;loop<N;loop++){
            if(done[loop]||done[A[loop][prog[loop]]-1])
                continue;
            if(A[A[loop][prog[loop]]-1][prog[A[loop][prog[loop]]-1]]==loop+1){
                done[loop]=1;
                done[A[loop][prog[loop]]-1]=1;
                prog[A[loop][prog[loop]]-1]++;
                if(prog[A[loop][prog[loop]]-1]==N-1){
                    doneAll[A[loop][prog[loop]]-1]=1;
                    progCt--;
                }
                prog[loop]++;
                if(prog[loop]==N-1){
                    doneAll[loop]=1;
                    progCt--;
                }
                worked=1;
            }
        }
        if(worked==0){
            ans=-1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>x;
    rep(i,n)cin>>a[i];
    rep(i,n){
        a[i]=abs(a[i]-x);
    }
    ans=a[0];
    rrep(i,1,n){
        ans=__gcd(ans,a[i]);
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 1024
#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>;
const int INF = 1 << 30;
 
int main() {
	string s;
	cin >> s;
	string t = s.substr(0, 3);
	cout << t << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;

typedef long double ld;
typedef pair<ld,int> P;

#define rep(i,x) for(int i = 0 ; i < x ; i ++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i ++)
#define pb push_back
#define fr first
#define sc second

const ld PI = 3.14159265359;
const ld EPS = 0.0;

bool f(vector<ld> vec){
	if(vec.size() == 0)return true;
	if(vec[vec.size()-1]-vec[0] < PI+EPS)return true;
	for(int j = 0 ; j+1 < vec.size() ; j ++){
		if(vec[j+1]-vec[j] > PI-EPS)return true;
	}
	return false;
}

int main(){
	int n;
	int x[1002],y[1002];
	scanf("%d",&n);
	rep1(i,n){
		scanf("%d%d",&x[i],&y[i]);
	}
	
	rep1(i,n){
		vector<long double> v[2];
		vector<P> vec;
		rep1(j,i-1){
			v[0].pb(atan2((ld)(y[j]-y[i]),(ld)(x[j]-x[i])));
			vec.pb(P(atan2((ld)(y[j]-y[i]),(ld)(x[j]-x[i])),j));
		}
		for(int j = i+1 ; j <= n ; j ++){
			v[1].pb(atan2((ld)(y[j]-y[i]),(ld)(x[j]-x[i])));
			vec.pb(P(atan2((ld)(y[j]-y[i]),(ld)(x[j]-x[i])),j));
		}
		
		if(!f(v[0]) || !f(v[1])){
			puts("Impossible");
			return 0;
		}
		sort(vec.begin(),vec.end());
		
		int cnt = 0;
		for(int j = 0 ; j+1 < vec.size() ; j ++){
			if((i-vec[j].sc)*(i-vec[j+1].sc)<0)cnt ++;
		}
		if(cnt >= 3){
			puts("Impossible");
			return 0;
		}
		if(cnt == 2){
			int s = 0;
			while((i-vec[s].sc)*(i-vec[s+1].sc)>0)s++;
			int t = s+1;
			while((i-vec[t].sc)*(i-vec[t+1].sc)>0)t++;
			t ++;
			if(vec[s].fr+2*PI-vec[t].fr > PI+EPS || vec[t-1].fr-vec[s+1].fr > PI+EPS){
				puts("Impossible");
				return 0;
			}
		}
		if(cnt == 1){
			int s = 0;
			while((i-vec[s].sc)*(i-vec[s+1].sc)>0)s++;
			if(vec[s].fr-vec[0].fr > PI+EPS || vec[vec.size()-1].fr-vec[s+1].fr > PI+EPS){
				puts("Impossible");
				return 0;
			}
		}
	}
	puts("Possible");
}




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

using namespace std;

int main()
{   int x, y;
    int b = 0;
    cin >> x >> y;
    for (int i = 0; i <= 100; ++i)
    {
            for (int j = 0; j <= 100; ++j)
            {
                if ((i + j == x) && (4*j+ 2*i == y))
                    b = 1;
            }
    }
        if (b == 1)
            cout << "Yes";
        else
            cout << "No";
   

}



Measured memory_bytes: 3632
#include <iostream>

using namespace std;

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

    int a[4], i = 0;
    a[i++] = y - x;
    a[i++] = -y - x + 1;
    a[i++] = y + x + 1;
    a[i++] = -y + x + 2;

    int ans = 1 << 30;
    for (i = 0; i < 4; i++) {
        if (a[i] < 0) continue;
        ans = min(ans, a[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define MAX 100001
#define MOD 1000000007
#define pii pair<long long , long long >
using namespace std;

vector<vector<int>> adj_list;

pii ways (int source , int parent = -1)
{
    int d=1ll,w=1ll;
    for(auto i:adj_list[source])
    {
        if(i != parent)
        {
            pii temp = ways(i,source);
            d = (d * temp.second)%MOD;
            w = (w * ((temp.first + temp.second)%MOD) )%MOD; 
        }
    }

    return {d,w};
}

 
int32_t main()
{
    int n;
    cin>>n;
    adj_list.resize(n);

    for(int i=0;i<n-1;++i)
    {
        int x,y;
        cin>>x>>y;
        adj_list[x-1].push_back(y-1);
        adj_list[y-1].push_back(x-1);
    }

    pii ans = ways(0, -1);

    cout<< ((ans.first + ans.second)%MOD) <<endl;


    return 0;
}

Measured memory_bytes: 12672
n, x, y = gets.split.map(&:to_i)

h = Hash.new(0)

1.upto(n-1) do |i|
  (i+1).upto(n) do |j|
    d = 
      [
        j - i,
        (x-i).abs + 1 + (y-j).abs,
        (y-i).abs + 1 + (x-j).abs,
      ].min
    h[d] += 1
  end
end

1.upto(n-1) do |i|
  puts h[i]
end

Measured memory_bytes: 3836
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
c=0
for i in range(k):
    q,d=t[i],1
    if i+k<n:
        for j in range(i+k,n,k):
            if q==t[j]:
                d+=1
            else:
                x=(d-1)//2+1
                if q=="r":
                    c+=x*p
                elif q=="s":
                    c+=x*r
                else:
                    c+=x*s
                q=t[j]
                d=1
    x=(d-1)//2+1
    if q=="r":
        c+=x*p
    elif q=="s":
        c+=x*r
    else:
        c+=x*s
print(c)

Measured memory_bytes: 44144
def prime_table(n):
    prime = [True]*(n+1)
    prime[0], prime[1] = False, False
    for i in range(2, n+1):
        if not prime[i]: continue
        j = 2*i
        while j <= n:
            prime[j] = False
            j += i
    return prime
N = 10**5
pt = prime_table(N)
cum = [0]*(N+1)
for i in range(1, N+1, 2):
    if pt[i] and pt[(i+1)//2]:
        cum[i] = 1
for i in range(1, N+1):
    cum[i] += cum[i-1]
Q = int(input())
ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(cum[r]-cum[l-1])
print(*ans, sep="\n")


Measured memory_bytes: 85320
k,s=map(int,input().split())
from math import factorial
def c(n,r):
  return factorial(n)//factorial(n-r)//factorial(r)
ans=0
for x in range(k+1):
  for y in range(k+1):
    if 0<=s-x-y<=k:
      ans += 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
  int K,sum=0,y=1;
  cin>>K;
  
  for(int a=1;a<K+1;a++){
    for(int b=1;b<K+1;b++){
      for(int c=1;c<K+1;c++){
        int mi=min(a,b);
          mi=min(mi,c);
          for(int x=1;x<mi+1;x++){
          if(a%x==0 && b%x==0 && c%x==0){y=x;}
          }
          sum+=y;
        
      }
    }
  }
  cout<<sum<<endl;
  return 0;
}
        
        
  


Measured memory_bytes: 3640
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)


int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if (a == b || b == c || c == a){
        if (a == b && b == c){
            cout << "No";
        }
        else cout << "Yes";
    }
    else cout << "No";
    

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i, n, max, min = 0;
	int a[10000] = {0};
	long sum = 0;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	
	max = a[0];
	min = a[0];
	
	for(i = 0; i < n; i++){
		if (max < a[i]){
			max = a[i];
		} if (min > a[i]){
			min = a[i];
		} 
		sum = a[i] + sum;
	}
	
	printf("%d %d %ld\n", min, max, sum);
	
	return 0;
	
}




Measured memory_bytes: 2128
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T, class U> int dcnt(T &x, U d) { int c = 0; while (x % d == 0) c++, x /= d; return c; }

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto &ai: a) cin >> ai;
    int ans = 0;
    for (int ai: a) ans += dcnt(ai, 2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int len = S.length();
    int ans = 1;
    string prev;
    prev += S[0];
    string s;
    rep(i, len - 1) {
        s += S[i + 1];
        if (prev != s) {
            ans++;
            //cout <<  prev << " " << s << endl;
            prev = s;
            s = "";
        }
    }
    //cout << "*" << prev << " " << s << endl;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#ifdef _MSC_VER
#  define __builtin_popcount __builtin_popcountll
#  define __builtin_popcountll __popcnt
#endif
#define int long long
using namespace std;
using ll = long long;
using ld = long double;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
inline void my_io() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << fixed << setprecision(10);
}
vector<long long>divisor(long long n) {
	vector<long long >res;
	for (long long i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			res.push_back(i);
			if (i != n / i) {
				res.push_back(n / i);
			}
		}
	}
	return res;
}
map<int, int> prime_factor(int n) {
	map<int, int>res;
	for (int i = 2; i*i <= n; i++) {
		while (n%i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1)res[n] = 1;
	return res;
}
long long mod_pow(long long x, long long n, long long mod) {//
	long long res = 1;
	while (n > 0) {
		if (n & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
signed main() {
	my_io();
	int n;//要素の数
	cin >> n;
	int p;//要素の積
	cin >> p;
	map<int,int> m = prime_factor(p);
	int ans = 1;
	for (auto e : m) {
		int sisuu = e.second / n;
		ans *= mod_pow(e.first, sisuu, numeric_limits<ll>::max());
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
long long a[200010];
long long  b[200010];
int main()
{
	long long  n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		a[b[i]]++;
	}
	long long  sum=0;
	for(int i=1;i<=n;i++)
	{
		sum=sum+(a[i]*(a[i]-1))/2;
	}
	
	for(int i=0;i<n;i++)
	{
		cout<<sum-(a[b[i]]-1)<<endl;
	}
 } 

Measured memory_bytes: 4736
import java.util.Arrays;
import java.util.Scanner;
public class Main{

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

		int n = stdIn.nextInt();
		String [] s = new String[n];

		for(int i = 0; i < n; i++) {
			s[i] = stdIn.next();
		}

		Arrays.sort(s);
		int cnt = 1;
		for(int i = 0; i < n-1; i++) {
			if(!s[i].equals(s[i+1])) {
				cnt++;
			}
		}
		if(cnt==3) {
			System.out.println("Three");
		}else {
			System.out.println("Four");
		}

	}

}


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

using namespace std;

#define INF 1001000100010001000
#define INFd 1010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define double long double
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define vd vector<double>
#define vvd vector<vd>

signed main()
{
    double len;
    char t;
    while (scanf("%Lf", &len) != EOF) {
        vi cake;
        while (scanf("%c", &t), t != '\n') {
            Int(tmp);
            cake.pb(tmp);
        }
        vvd dp(1 << cake.size(), vd(cake.size(), INFd));
        dp[0][0] = 0.0;


        rep(i, cake.size()) {
            int tmp = 1 << i;
            dp[tmp][i] = cake[i];
        }

        rep(i, 1 << cake.size()) {
            rep(j, cake.size()) {
                if (i & (1 << j)) {
                    rep(k, cake.size()) {
                        if (!(i & (1 << k))) {
                            dp[i|(1 << k)][k] = min(dp[i|(1 << k)][k],
                                    dp[i][j] + 
                                    sqrt( (double)((cake[j]+cake[k])*(cake[j]+cake[k]) - 
                                            (cake[k]-cake[j])*(cake[k]-cake[j])) ));
                        }
                    }
                }
            }
        }
        bool ans = false;
        rep(i, cake.size()) {
            if (len >= dp[(1 << cake.size())-1][i] + (double)cake[i]) {
                ans = true;
                break;
            }
        }
        cout << ( (ans) ? "OK" : "NA" ) << endl;
    }

    return 0;
}

Measured memory_bytes: 3960
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

uint64_t calcXOR(uint64_t N);
static inline void MainTask() {
  uint64_t A, B;
  cin >> A >> B;
  uint64_t res = 0;
  res = calcXOR(A - 1);
  res ^= calcXOR(B);
  cout << res << endl;
}

uint64_t calcXOR(uint64_t N) {
  uint64_t ret = 0;
  if (N & 0x01) {
    return ((N + 1) >> 1) & 0x01;
  } else {
    return N ^ ((N >> 1) & 0x01);
  }
}

int main() {
  MainTask();
  return 0;
}


Measured memory_bytes: 256
//g++ -std=gnu++14 a.cpp
//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  int N;
  cin >> N;
  vector<int> a(100010);
  vector<int> b(100010);
  vector<int> c(100010);
  rep(i,N){
    cin >> a[i] >> b[i] >> c[i];
  }
  ll dp[100010][3];
  rep(i,100010){
    rep(j,3){
      dp[i][j] = 0;
    }
  }

  for(int i = 1;i <= N;i++){
    dp[i][0] = max(dp[i-1][1]+b[i-1],dp[i-1][2]+c[i-1]);
    dp[i][1] = max(dp[i-1][0]+a[i-1],dp[i-1][2]+c[i-1]);
    dp[i][2] = max(dp[i-1][0]+a[i-1],dp[i-1][1]+b[i-1]);
  }

  ll ans;
  ans = max(dp[N][0],dp[N][1]);
  ans = max(ans,dp[N][2]);

  cout << ans << endl;

}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
  for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
  for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
  return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
  os<<"{ ";for(auto m:M)os<<"("<<m.first<<":"<<m.second<<")";
  return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
//For multiset use less_equal operator but it does support erase operations for multiset
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define all(v) (v).begin(),(v).end()
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair


const int mod = 1e9+7;

inline int add(int a,int b){a+=b;if(a>=mod)a-=mod; return a;} 
inline int sub(int a,int b){a-=b;if(a<0) a += mod; return a;}
inline int mul(int a, int b){ return a*1ll*b%mod;}
inline int power(int x, ll y){
  int res = 1;
  while(y){
    if(y&1) res = mul(res , x);
    x = mul(x,x);
    y >>= 1;
  }
  return res;
}
const int N = 1e6 + 100;

int spf[N];

void sieve(){
  for(int i =1 ;i < N ;++i) spf[i] = i;

  for(int i =2 ;i < N ; ++i){
    if(spf[i] == i){
      for(ll j = i*1ll*i; j < N ; j += i){
        if(spf[j] == j) spf[j] = i;
      }
    }
  }

}
int cnt[N];

int main(){
  fio; cout<<fixed<<setprecision(25);	
  sieve();
  int gd = 0;
  int x;
  int n ;cin >> n;
  for(int i =1 ;i <= n ; ++i){
    cin >> x;
    gd = __gcd(gd , x);
    while(x != 1){
      cnt[spf[x]]++;
      int y = spf[x];
      while(x%y == 0)
        x /= y;
    }
  }
  bool ok = 1;
  for(int i = 1 ;i < N ; ++i) if(cnt[i] > 1) ok = 0;

  if(ok) cout << "pairwise coprime" << endl;
  else if(gd == 1) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
  return 0;
}
























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

int main()
{
	int n = 0, a[120] = { 0 }, b = 0, f = 0, r = 0, v = 0, k = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		k = (b - 1) * 30 + (f - 1) * 10 + r - 1;
		a[k] += v;
	}

	for (int i = 0; i < 120; i++) {
		cout << " " << a[i];
		if ((i % 10) == 9)
			cout << endl;
		if ((i % 30) == 29 && i < 100)
			cout << "####################" << endl;
	}

    return 0;
}

Measured memory_bytes: 3100
#include<iostream>
using namespace std;
#define REP(i, b, e) for ( int i = b; i < e; i++ )
#define rep(i, n) REP(i, 0, n)
#define MAX 1001

main(){
  int H, W, T[MAX][MAX][3], q, i1, j1, i2, j2;
  char ch;
  cin >> H >> W >> q;

  rep(i, H+1) rep(j, W+1) rep(k, 3) T[i][j][k] = 0;

  REP(i, 1, H+1) REP(j, 1, W+1){
      cin >> ch;
      if ( ch == 'J' ) T[i][j][0]++;
      if ( ch == 'O' ) T[i][j][1]++;
      if ( ch == 'I' ) T[i][j][2]++;
  }

  REP(i, 1, H+1) REP(j, 1, W+1) rep (k, 3) T[i][j][k] += T[i][j-1][k];
  REP(i, 1, H+1) REP(j, 1, W+1) rep (k, 3) T[i][j][k] += T[i-1][j][k];
  rep(i, q){
   cin >> i1 >> j1 >> i2 >> j2;
   rep(k, 3){
      if ( k ) cout << " ";
      cout << T[i2][j2][k] - T[i2][j1-1][k] - T[i1-1][j2][k] + T[i1-1][j1-1][k];
    }
    cout << endl;
  }
}

Measured memory_bytes: 12000
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

double memo[3003][3003],a[3003];
bool done[3003][3003];

double solve(int i, int j){
	if(done[i][j]){
		return memo[i][j];
	}
	done[i][j] = true;
	if(i==0 && j==0){
		memo[i][j] = 1;
		return memo[i][j];
	}else if(i==0){
		memo[i][j] = solve(i,j-1)*(1-a[i+j]);
		return memo[i][j];
	}else if(j==0){
		memo[i][j] = solve(i-1,j)*a[i+j];
		return memo[i][j];
	}else{
		memo[i][j] = solve(i,j-1)*(1-a[i+j])+solve(i-1,j)*a[i+j];
		return memo[i][j];
	}
}

int main(void){
	int n,i;
	double ans = 0;
	fill(done[0],done[3003],false);
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i+1];
	}
	for(i=0; i<(n-i); ++i){
		ans += solve(n-i,i);
	}
	printf("%.10lf\n",ans);
	return 0;
}


Measured memory_bytes: 78464
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


void solve(std::string S, std::string T, long long A, long long B, std::string U){
	if (S==U){
		A--;
	}
	else{
		B--;
	}
	cout << A << " " << B << endl;

}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string U;
    std::cin >> U;
    solve(S, T, A, B, U);
    return 0;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
Ls = list(map(int, input().split()))

count = 0
position = 0
for i in range(N):
    if X<position:
        break
    else:
        count += 1
        position += Ls[i]

if X<position:
    pass
else:
    count += 1

print(count)

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

using namespace std;

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

    int N;
    int K;

    cin >> N >> K;

    if(N % 2 == 1){
        if(N / 2 + 1 >= K){
            cout << "YES";
        }else{
            cout << "NO";
        }
    }else{
        if(N / 2 >= K){
            cout << "YES";
        }else{
            cout << "NO";
        }
    }

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Queue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] s = br.readLine().split(" ");
		int h = Integer.parseInt(s[0]);
		int w = Integer.parseInt(s[1]);
		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			a[i] = br.readLine().toCharArray();
		}
		br.close();

		boolean[][] flg = new boolean[h][w];
		Queue<Obj> que = new ArrayDeque<Obj>();
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (a[i][j] == '#') {
					flg[i][j] = true;
					Obj o = new Obj();
					o.x = i;
					o.y = j;
					o.v = 0;
					que.add(o);
				}
			}
		}

		int ans = 0;
		int[] x = {-1, 0, 0, 1};
		int[] y = {0, -1, 1, 0};
		while (!que.isEmpty()) {
			Obj cur = que.poll();
			for (int i = 0; i < 4; i++) {
				int nx = cur.x + x[i];
				int ny = cur.y + y[i];
				ans = Math.max(ans, cur.v);
				if (nx < 0 || h <= nx || ny < 0 || w <= ny) {
					continue;
				}
				if (!flg[nx][ny]) {
					flg[nx][ny] = true;
					Obj o = new Obj();
					o.x = nx;
					o.y = ny;
					o.v = cur.v + 1;
					que.add(o);
				}
			}
		}
		System.out.println(ans);
	}

	static class Obj {
		int x, y, v;
	}
}


Measured memory_bytes: 64788
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws Exception
	{
		new Main().run();
	}
	
	node[] nodes;
	
	public void run() throws Exception
	{
		BufferedReader file = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(file.readLine());
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		nodes = new node[N];
		for(int i = 0;i<N;i++)
			nodes[i] = new node(i);
		for(int i = 0;i<N - 1;i++)
		{
			st = new StringTokenizer(file.readLine());
			int a = Integer.parseInt(st.nextToken())-1;
			int b = Integer.parseInt(st.nextToken())-1;
			nodes[a].edges.add(b);
			nodes[b].edges.add(a);
		}
		for(int i = 0;i<M;i++)
		{
			st = new StringTokenizer(file.readLine());
			int a = Integer.parseInt(st.nextToken())-1;
			int b = Integer.parseInt(st.nextToken());
			nodes[a].amt+=b;
		}
		dfs(0,-1,0);
		StringBuilder sb = new StringBuilder("");
		for(node n:nodes) {
			sb.append(n.total);
			sb.append(" ");
		}
		System.out.println(sb.toString().trim());
	}
	
	public void dfs(int v, int p, long sum)
	{
		nodes[v].total = nodes[v].amt + sum;
		for(int x:nodes[v].edges)
		{
			if(x!=p)
			{
				dfs(x,v,nodes[v].total);
			}
		}
	}
	
	private class node{
		
		ArrayList<Integer> edges;
		int id;
		int amt = 0;
		long total = 0;
		
		public node(int id)
		{
			edges = new ArrayList<Integer>();
		}
		
	}
}


Measured memory_bytes: 151560
import itertools

S = input()
N = len(S)
if all(S[0] == c for c in S):
    print(1)
    exit()
if N == 2:
    print(1 if S[0]==S[1] else 2)
    exit()

if N == 3:
    def another(a,b):
        s = set('abc')
        s -= set([a,b])
        return list(s)[0]
    ptn = set()
    stack = [S]
    while stack:
        a = stack.pop()
        ptn.add(a)
        if a[0] != a[1]:
            b = another(a[0],a[1])*2 + a[2]
            if not b in ptn:
                stack.append(b)
        if a[1] != a[2]:
            c = a[0] + another(a[1],a[2])*2
            if not c in ptn:
                stack.append(c)
    print(len(ptn))
    exit()

#N >= 4
MOD = 998244353
dp = [[[0 for u in range(2)] for l in range(3)] for s in range(3)]
#dp[sum%3][last][exist'xx'?]
for ptn in itertools.product(range(3),repeat=4):
    seq = (ptn[0]==ptn[1] or ptn[1]==ptn[2] or ptn[2]==ptn[3])
    dp[sum(ptn)%3][ptn[3]][seq] += 1

for n in range(4,N):
    dp2 = [[[0 for u in range(2)] for l in range(3)] for s in range(3)]
    for s in range(3):
        for l in range(3):
            for u in range(2):
                for l2 in range(3):
                    s2 = (s+l2)%3
                    u2 = u or l==l2
                    dp2[s2][l2][u2] += dp[s][l][u]
                    dp2[s2][l2][u2] %= MOD
    dp = dp2

sm = 0
for c in S:
    sm += ord(c) - ord('a')
seq = False
for c1,c2 in zip(S,S[1:]):
    if c1 == c2:
        seq = True
        break
ans = sum([dp[sm%3][i][1] for i in range(3)])
if not seq: ans += 1
print(ans % MOD)


Measured memory_bytes: 49120
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 62;
int main() {
  //
  ll x, y;
  cin >> x >> y;
  if (abs(x - y) <= 1) {
    cout << "Brown" << endl;
  } else {
    cout << "Alice" << endl;
  }
  return 0;
}


Measured memory_bytes: 888
#include <cstdio>
#include <set>

using namespace std;

#define MAX 300000

int main()
{
	bool is_prime[MAX+1] = {false};
	for(int i = 6; i <= MAX; i += 7) {
		is_prime[i] = true;
	}
	for(int i = 8; i <= MAX; i += 7) {
		is_prime[i] = true;
	}
	for(int i = 6; i <= MAX; i++) {
		if(!is_prime[i]) continue;
		for(int j = i * 2; j <= MAX; j += i) {
			is_prime[j] = false;
		}
	}

	while(1) {
		int n;
		set<int> p_factors;

		scanf("%d", &n);
		if(n == 1) break;

		for(int i = 6; i <= MAX; i += 7) {
			if(!is_prime[i] || n % i != 0) continue;
			p_factors.insert(i);
		}
		for(int i = 8; i <= MAX; i += 7) {
			if(!is_prime[i] || n % i != 0) continue;
			p_factors.insert(i);
		}

		printf("%d:", n);
		for(set<int>::iterator it = p_factors.begin(); it != p_factors.end(); it++) {
			printf(" %d", *it);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1328
"""
入力
"""
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

"""
ライブラリ
"""

"""
処理
"""
a.sort()
b.sort()
c.sort()

total = 0
import bisect
for _b in b:
    n_a = bisect.bisect_left(a, _b)
    n_c = n - bisect.bisect_right(c, _b)
    total += n_a * n_c
print(total)

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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	long long k;
	cin >> k;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	std::set<int> s;
	s.insert(0);
	int i = 0;
	int v = 0;
	int loop_start, loop_end;
	map<int, int> m;
	int loop_end_i;
	while (1) {
		m.insert(make_pair(v, i));
		if (s.find(a[v]-1) != s.end()) {
			loop_start = a[v]-1;
			loop_end = v;
			loop_end_i = i;
			break;
		}
		v = a[v]-1;
		s.insert(v);
		i++;
	}

	int loop_start_i = m.at(loop_start);
	int loop_len = loop_end_i - loop_start_i+1;
	long long h = (k-loop_start_i);
	if (h < 0) {
		int v = 0;
		for (int i = 0; i < k; i++) {
			v = a[v]-1;
		}
		cout << v+1 << endl;
	}else {
		if (loop_len != 0)
			h %= loop_len;

		int v = loop_start;
		for (int i = 0; i < h; i++) {
			v = a[v]-1;
		}
		cout << v+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 22948
/**Bismillahir Rahmanir Rahim.**/
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include <bits/stdc++.h>
using namespace std;


#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  ll               long long
#define  vi               std::vector<int>
#define  pb               push_back
#define  MAX              100007
#define  End              return 0;
#define                   pi acos(-1)


int main () {
   int n;
   cin>>n;
   map<string,int>mp;
   map<string,int>::iterator it;
   int x=0;
   for(int i=0; i<n; i++){
         string s;
         cin>>s;
         mp[s]++;
         x=max(x,mp[s]);
   }
   for(it=mp.begin(); it!=mp.end(); it++){
        if(it->second==x) cout<<it->first<<endl;
   }
    End;
}
/* pray for me
Do before die
*/





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

int main(){

    int d,n,ans;

    cin>>d>>n;
    if(n==100)n++;
    if(d==0)cout<<n;
    else if(d==1)cout<<n<<0<<0;
    else if(d==2)cout<<n<<0<<0<<0<<0;
    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(1,N-1):
	if A[i-1]>A[i] and A[i]>A[i+1]:
		count += 1
	elif A[i-1]<A[i] and A[i]<A[i+1]:
		count += 1
print(count)

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

int main(){
	int N;
	cin >> N;
	vector<string> S;
	bool f=true;
	string bf;
	for(int i=0; i<N; i++){
		string s; cin >> s;
		auto itr = find(S.begin(),S.end(),s);
		if(i && s[0] != bf[bf.size()-1]){ f=false; }
		if(itr != S.end()){ f=false; }
		S.push_back(s);
		bf = s;
	}
	if(f)cout << "Yes" << endl;
	else cout << "No" << endl; 
	return 0;
}

Measured memory_bytes: 256
def read2():
	return map(int, raw_input().split())
def read1():
	return raw_input().split()

h, w = read2()
for i in xrange(h):
	s = read1()
	for j in xrange(w):
	    if s[j] == "snuke":
	        print "%c%d" % (65 + j, i+1)


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  
  sort(S.begin(),S.end());
  
  for(int i=1;i<S.size();i++){
    if(S.at(i)-S.at(i-1)==0){
      cout<<"no"<<endl;
      break;
    }
    if(S.at(i)-S.at(i-1)>0&&i==S.size()-1){
cout<<"yes"<<endl;
      break;
    }

  }
}


Measured memory_bytes: 256
mod = 10 ** 9 + 7
N = 10 ** 5 + 1
fact = [1] * (N + 1)
ifact = [1] * (N + 1)

for i in range(N):
    fact[i + 1] = fact[i] * (i + 1) % mod
    ifact[i + 1] = pow(fact[i + 1], mod - 2, mod)


def comb(x, y):
    if y < 0 or y > x:
        return 0
    return (fact[x] * ifact[x - y] * ifact[y]) % mod


n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
ar = sorted(a, reverse=True)

ans = 0
for i in range(k - 1, n):
    ans += a[i] * comb(i, k - 1) % mod
    ans -= ar[i] * comb(i, k - 1) % mod
    ans %= mod

print(ans)


Measured memory_bytes: 93156
h,w=map(int,input().split())
s=[[0]+list(input())+[0]for i in range(h)]
s.insert(0,[0]*(w+2))
s.append([0]*(w+2))
c=["#","."]
n=0
for i in range(1,h+1):
    for j in range(1,w+1):
        g=[0,0]
        if s[i][j]!=0:
            p=c.index(s[i][j])
            g[c.index(s[i][j])]+=1
            k=[[i,j]]
            s[i][j]=0
            while len(k)>0:
                b=[]
                for f in range(len(k)):
                    if s[k[f][0]+1][k[f][1]]==c[(p+1)%2]:
                        b.append([k[f][0]+1,k[f][1]])
                        s[k[f][0]+1][k[f][1]]=0
                    if s[k[f][0]-1][k[f][1]]==c[(p+1)%2]:
                        b.append([k[f][0]-1,k[f][1]])
                        s[k[f][0]-1][k[f][1]]=0
                    if s[k[f][0]][k[f][1]+1]==c[(p+1)%2]:
                        b.append([k[f][0],k[f][1]+1])
                        s[k[f][0]][k[f][1]+1]=0
                    if s[k[f][0]][k[f][1]-1]==c[(p+1)%2]:
                        b.append([k[f][0],k[f][1]-1])
                        s[k[f][0]][k[f][1]-1]=0
                else:
                    k=b
                    g[(p+1)%2]+=len(b)
                    p+=1
            else:
                n+=g[0]*g[1]
else:
    print(n)

Measured memory_bytes: 4468
# -*- coding: utf-8 -*-
# import numpy as np
# N = input()
a, b, k = map(int, raw_input().split())


if a + 2 * k - 2 >= b:
    for i in range(a, b + 1):
        print i
else:
    for i in range(a, a + k):
        print i
    for i in range(b - k + 1, b + 1):
        print i




Measured memory_bytes: 2568
package main

import (
	"fmt"
)

func main(){
	var N,cnt int
	fmt.Scan(&N)
	
	slice := make([]int,N)
	for i := 0; i < N; i++ {
		fmt.Scan(&slice[i])
	}
	
	judge := true
	for judge {
		for i := 0; i < N; i++ {
			if slice[i] % 2 == 0 {
				slice[i] = slice[i] / 2
			} else {
				judge = false
				break
			}
		}
		if judge {
			cnt++
		}
	}
	fmt.Println(cnt)
}

Measured memory_bytes: 512
n = int(input())
mod = 10 ** 9 + 7
#?AGC,?ACG,A?GC,AG?C,?GAC

A, G, C, T = 0, 1, 2, 3
#[[[],[]],]
#dp[i][A][T][C] += dp[i - 1][][][]
dp = [[] for i in range(n + 1)]
for i in range(n + 1):
    for j in range(4):
        dp[i].append([])
for i in range(n + 1):
    for j in range(4):
        for k in range(4):
            dp[i][j].append([])
for i in range(n + 1):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                dp[i][j][k].append(0)
dp[0][T][T][T] = 1

for leng in range(n):
    for c1 in range(4):
        for c2 in range(4):
            for c3 in range(4):
                if dp[leng][c1][c2][c3] == 0:
                    continue
                for x in range(4):
                    if x == C and c1 == G and c2 == A:
                        continue
                    if x == G and c1 == C and c2 == A:
                        continue
                    if x == C and c1 == G and c3 == A:
                        continue
                    if x == C and c2 == G and c3 == A:
                        continue
                    if x == C and c1 == A and c2 == G:
                        continue
                    dp[leng + 1][x][c1][c2] += dp[leng][c1][c2][c3]
                    dp[leng + 1][x][c1][c2] %= mod

ans = 0
for j in range(4):
    for k in range(4):
        for l in range(4):
            ans += dp[n][j][k][l]
            ans %= mod
print(ans)

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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define ll unsigned long long
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

const int Maxn = (int)1e6;
const ld pi = acos(-1);
const int mod = (int)1e9 + 7;
const int inf = (int)1e18;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
    fr(i, 0, (int)A.size()) out << A[i] << " ";
    return out;
}

//}


int32_t main() {
    IOS string s,t; cin>>s>>t;
    int ans = 0;
    fr(i,0,(int)s.size()){
        if(s[i] != t[i])    ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3820
#include <iostream>
 
using namespace std;
 
int main()
{
   int S, h, m, s;
   cin>> S;
   h = S / 3600;
   m = S % 3600 / 60;
   s = S % 60;
    
   cout<< h << ":" << m << ":" << s << endl;
    
}   


Measured memory_bytes: 3116
using System;

class Program
{
    static void Main(string[] args)
    {
        int kai = int.Parse(Console.ReadLine());

        int countAC = 0;
        int countWA = 0;
        int countTLE = 0;
        int countRE = 0;

        for (int i = 0; i < kai; i++)
        {
            string str = Console.ReadLine();

            switch (str)
            {
                case "AC":
                    countAC++;
                    break;
                case "WA":
                    countWA++;
                    break;
                case "TLE":
                    countTLE++;
                    break;
                case "RE":
                    countRE++;
                    break;
            }
        }

        Console.WriteLine($"AC x {countAC}\nWA x {countWA}\nTLE x {countTLE}\nRE x {countRE}\n");
    }
}

Measured memory_bytes: 30388
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

int main(){
    int x;
    cin >> x;
    cout << x * x * x << endl;
    return 0;
}

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

int main(){
  int N; cin>>N;
  int d[110];
  for (int i=0;i<N;++i)cin>>d[i];
  
  set<int>values;
  for (int i=0;i<N;++i){
    values.insert(d[i]);
  }
  
  cout<<values.size()<<endl;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

bool comp(const string& f, const string& s){
    return f.size() < s.size();
}
int main(void){
    int a, b;
    cin >> a >> b;

    if(a + b < 24){
        cout << a + b << endl;
    } else {
        cout << a + b - 24 << endl;
    }
}

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

public class Hello
{
    public static void Main()
    {
        var a = new bool[110000];
        GeneratePrime(a);
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var p = int.Parse(line[1]);
            if (n == -1 && p == -1) break;
            var t = n + 1;
            var ba = new int[25];
            var count = 0;
            while (count < ba.Length)
            {
                if (a[t]) ba[count++] = t;
                t++;
            }
            Console.WriteLine(getAns(ba,p));
        }
    }
    public static int getAns (int[] a ,int p)
    {
        var aL = a.Length;
        var ret = new List<int>();
        for (int i = 0; i < aL; i++)
            for (int j = i; j < aL; j++) ret.Add(a[i] + a[j]);
        ret.Sort();
        return ret[p - 1];
    }
    public static void GeneratePrime(bool[] p)
    {
        int prime;
        var m = p.Length;
        var sqrtMax = Math.Sqrt(m);
        var searchList = Enumerable.Range(2, m - 1).ToList();
        do
        {
            prime = searchList.First();
            p[prime] = true;
            searchList.RemoveAll(n => n % prime == 0);
        }
        while (prime < sqrtMax);
        foreach (var x in searchList)
            p[x] = true;
    }
}



Measured memory_bytes: 10676