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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
void dump(){cout<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cout<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

void solve1();void solve2();
int main(){
  solve1();
  return 0;
}

void solve1(){

  ll h,w,k;
  cin>>h>>w>>k;
  vector<string> s(h);
  cin>>s;

  if(h==1&&w==1){
    cout<<1<<endl;
    return;
  }

  ll num=1;
  auto ans = make_vector<ll>(h,w);
  rep(i,h)rep(j,w){
    if(s[i][j]=='#')ans[i][j]=num++;
  }

  vector<bool> flag(h,false);
  rep(i,h)rep(j,w)if(s[i][j]=='#')flag[i]=true;
  // 横にのばす
  rep(i,h){
    rep(j,w-1){
      if(ans[i][j]!=0&&ans[i][j+1]==0){
        ans[i][j+1]=ans[i][j];
      }
    }
    for(ll j=w-1;j>0;--j){
      if(ans[i][j]!=0&&ans[i][j-1]==0){
        ans[i][j-1]=ans[i][j];
      }
    }
  }

  vector<ll> idxs;
  rep(i,h){
    if(flag[i])idxs.emplace_back(i);
  }
  rep(i,h){
    if(!flag[i]){
      auto itr = lower_bound(idxs.begin(),idxs.end(),i);
      if(itr!=idxs.end()){
        ll idx = *itr;
        for(ll j=i;j<idx;++j){
          ans[j]=ans[idx];
        }
        i=idx;
      }else{
        itr--;
        ll idx = *itr;
        for(ll j=i;j<h;++j){
          ans[j]=ans[idx];
        }
        break;
      }
    }
  }

  for(auto y:ans){
    for(auto x:y){
      cout<<x<<" ";
    }
    cout<<endl;
  }

}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const ll  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

/*vll adj[MAXN];ll visit[MAXN]={};
ll dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,k,d,w,summ;
string s,t;
vll a,b;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN(ll _) {
	cin >> s >> t;
	n = s.length();
	m = t.length();
	ll mini = INT_MAX;


	for(ll i=0;i<=n-m;i++) {
		ll cou = 0;
		for(ll j=0;j<m;j++) {
			cou += (s[i+j]!=t[j]);
		}
		mini = min(mini, cou);
	}

	cout<<mini;newl;
}

int main() {
	fastio;randomINT;
	//freopen("out_hc.txt","w+",stdout);
	//cin>>T;
	for(ll i=1;i<=T;i++) {
		MAIN(i);
	}
	return 0;
}



Measured memory_bytes: 3620
using System;
using System.Linq;
using System.Text;
static class Define
{
    // public const long Infty = 100000001;//const 上書きできない
    public const long Infty = long.MaxValue;//const 上書きできない
}
namespace ALDS_1_5_B
{
    class Program
    {
        public static long cnt = 0;
        public static long n = 0;
        public static long[] A = new long[n];
        public static void Merge(long[] A, long left, long mid, long right)
        {
            long n1 = mid - left;
            long n2 = right - mid;
            //L[0,,,n1]、R[0,,,n2]を生成
            long[] L = new long[n1 + (long)1];
            long[] R = new long[n2 + (long)1];
            for (long i = 0; i < n1; i++) L[i] = A[left + i];
            for (long i = 0; i < n2; i++) R[i] = A[mid + i];
            L[n1] = Define.Infty;
            R[n2] = Define.Infty;
            long l = 0;
            long m = 0;
            try
            {

                for (long k = left; k < right; k++)//k=0～n-1
                {
                    cnt++;
                    if (L[l] <= R[m])
                    {
                        A[k] = L[l];
                        l++;
                    }
                    else
                    {
                        A[k] = R[m];
                        m++;
                    }
                }
            }
            catch (Exception e)
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("L;");
                foreach (var item in L)
                {
                    builder.Append(item + "/");
                }
                builder.Append(" / R;");
                foreach (var item in R)
                {
                    builder.Append(item + "/");
                }
                builder.Append(n1 + "/" + n2 + "/" + m + "/" + left + "/" + mid + "/" + right + "/" + A.Length);
                throw new ArgumentException(e.Message + builder.ToString());
            }

        }
        public static void MergeSort(long[] A, long left, long right)
        {
            if (right - left > 1)
            {//継続条件
                long mid = left + (right - left) / (long)2;
                MergeSort(A, left, mid);
                MergeSort(A, mid, right);
                Merge(A, left, mid, right);
            }
        }

        public static void Main()
        {
            //入力
            n = long.Parse(Console.ReadLine());
            string[] text1 = Console.ReadLine().Split(' ');
            A = text1.Select(s => long.Parse(s)).ToArray();
            // A = new long[] { 100000002, 100000002, 100000002, 100000002, 100000002, 100000002, 100000002, 100000002};
            n = A.Length;
            //探索ソート
            MergeSort(A, 0, n);
            //出力
            Console.Write(A[0]);
            for (long i = 1; i < n; i++)
            {
                Console.Write(" {0}", A[i]);
            }
            Console.WriteLine();
            Console.WriteLine(cnt);
        }
    }

}



Measured memory_bytes: 73992
#template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
A,B,C = inputlist()
if A+B>=C:
    print(B+C)
else:
    count = 0
    count = 2*B
    C -=B
    if C <= A+1:
        count +=C
    else:
        count += A+1
    print(count)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=1e5,INF=1e8;
bool ans;
int B,dp[MAX_N],N;
vector<int> G[MAX_N];
void dfs(int v,int p){
	vector<int> vec;
	int n=0;
	for(auto e:G[v]){
		if (e!=p){
			dfs(e,v);
			vec.push_back(dp[e]);
			n++;
		}
	}
	sort(vec.begin(),vec.end());
	dp[v]=INF;
	if (n%2==0){
		bool f=true;
		REP(i,n/2){
			if (vec[i]+vec[n-i-1]+2>B){
				f=false;
			}
		}
		if (f){
			dp[v]=0;
		}
		if (n==0){
			return ;
		}
	}
	if (p!=-1 || n%2){
		if (n%2==0){
			if (vec[n-1]+1>B){
				return;
			}
			n--;
		}
		if (vec[n-1]+1>B){
			return;
		}
		int lb=-1,ub=n;
		while(ub-lb>1){
			int mid=(lb+ub)/2;
			int le=0,ri=n-1;
			bool f=true;
			REP(i,n/2){
				if (le==mid){
					le++;
				}
				if (ri==mid){
					ri--;
				}
				if (vec[le]+vec[ri]+2>B){
					f=false;
				}
				le++;
				ri--;
			}
			if (f){
				ub=mid;
			}else{
				lb=mid;
			}
		}
		if (ub!=n){
			dp[v]=min(dp[v],vec[ub]+1);
		}
	}
}

int main(){
	cin>>N;
	REP(i,N-1){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int A=0;
	REP(i,N){
		if (G[i].size()%2){
			A++;
		}
	}
	A/=2;
	int lb=0,ub=N-1;
	while(ub-lb>1){
		int mid=(lb+ub)/2;
		B=mid;
		ans=true;
		dfs(0,-1);
		REP(i,N){
			if (dp[i]==INF){
				ans=false;
			}
		}
		if (ans){
			ub=mid;
		}else{
			lb=mid;
		}
	}
	cout<<A<<" "<<ub<<endl;
	return 0;
}

Measured memory_bytes: 15360
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
string s, t;
int dp[3100][3100] = {0};

int main() {

    cin >> s >> t;
    int snoSize = s.size();
    int tSize = t.size();

    rep(i, 0, snoSize) {
        rep(r, 0, tSize) {
            if(s[i] == t[r]) {
                chmax(dp[i + 1][r + 1], dp[i][r] + 1);
                // cout << "s:" << s[i] << ",t:" << t[i] << endl;
            }
            chmax(dp[i + 1][r + 1], dp[i + 1][r]);
            chmax(dp[i + 1][r + 1], dp[i][r + 1]);
        }
    }

    // cout << dp[snoSize][tSize] << endl;
    string res = "";
    int i = snoSize;
    int r = tSize;
    while(i > 0 && r > 0) {
        if(dp[i][r] == dp[i - 1][r]) {
            --i;
        } else if(dp[i][r] == dp[i][r - 1]) {
            --r;
        } else {
            res = s[i - 1] + res;
            --i, --r;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 37120
n, m, s = map(int, input().split())
rail = [[] for _ in range(n)]
fare = [[] for _ in range(n)]
time = [[] for _ in range(n)]
rate = []
TIME = []
for _ in range(m):
    i, j, k, l = map(int, input().split())
    i -= 1
    j -= 1
    rail[i].append(j)
    rail[j].append(i)
    fare[i].append(k)
    fare[j].append(k)
    time[i].append(l)
    time[j].append(l)
for _ in range(n):
    i, j = map(int, input().split())
    rate.append(i)
    TIME.append(j)
    
# Dijkstra's algorithm
# 銀貨の枚数がlimit以上になったら捨てる
limit = [max(i) for i in fare]
limit = max(limit) * n
if s >= limit:
    s = limit - 1

# dp[i][j] = 都市iで銀貨j枚を持っているための必要最小時間
dp = [[float('inf')] * limit for _ in range(n)]

# candidateに(必要時間, 都市番号, 銀貨の枚数)を追加していく
import heapq
candidate = [(0, 0, s)]
heapq.heapify(candidate)

ans = [-1] * n
todo = n

while todo > 0:
    i, j, k = heapq.heappop(candidate)
    if dp[j][k] != float('inf'):
        continue
    dp[j][k] = i
    if ans[j] == -1:
        ans[j] = i
        todo -= 1

    # 鉄道移動をcandidateに追加
    for l in range(len(rail[j])):
        if fare[j][l] <= k and dp[rail[j][l]][k - fare[j][l]] == float('inf'):
            heapq.heappush(candidate, (i + time[j][l], rail[j][l], k - fare[j][l]))
    
    # 両替をcandidateに追加
    if k < limit - 1:
        heapq.heappush(candidate, (i + TIME[j], j, min([k + rate[j], limit - 1])))

for i in range(1, n):
    print(ans[i])

Measured memory_bytes: 39016
#include<stdio.h>
int main(){
	int a,b,ans,k;
	scanf("%d%d",&a,&b);
	for(ans=1;ans<=10000;ans++){
		if(ans*8/100==a&&ans/10==b) break;
	}
	if(ans==10001) printf("-1");
	else printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, y;
	while (cin >> x >> y, x|y) {
		if (x < y)cout << x << " " << y << endl;
		else cout << y << " " << x << endl;
	}
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int K;
  int X;
  cin >> K;
  cin >> X;
  int j = K -1;
  int startNo = X - j;
  int finishNo = X + j;
  if(finishNo > 1000000){
  finishNo = 1000000;
  }
  if(startNo < -1000000){
  startNo = -1000000;
  }
  
  for (int i = 0; i < 1000; i++) {
  cout << startNo;
  cout << " ";
  
  if(startNo == finishNo){
  break;
  }
    startNo++;
}
  
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000000;
ll POW(ll x,ll y){
    ll n = 1;
    for(int i = 0;i < y;i++){
        n*=x;
    }
    return n;
}

int main(){
    int n,m;
    cin >> n >> m;
    priority_queue<ll> a;
    for(int i = 1;i <= n;i++){
        ll A;
        cin >> A;
        a.push(A);
    }
    for(int i = 0;i < m;i++){
        ll e = a.top();
        a.pop();
        e /= 2;
        a.push(e);
    }
    ll ans = 0;
    for(int i = 0;i < n;i++){
        ans += a.top();
        a.pop();
    }
    cout << ans << endl;
    //cin >> n;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int A = scan.nextInt();
	int B = scan.nextInt();
	int C = scan.nextInt();

	System.out.println(C >= A && C <= B ? "Yes" : "No");
	scan.close();
    }
}


Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <math.h>
#include <sstream>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>
#include <unordered_map>
using namespace std;
typedef long long ll;
ll ans, mx, sum,temp, mn = 1e14, flag,cnt;

int main(){
	ll a,p;
	cin>>a>>p;
	cout<<((a*3)+p)/2;
}

Measured memory_bytes: 3488
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    int N;
    int[] a;

    AtCoder(FastScanner sc) {
        N = sc.nextInt();
        a = sc.arrayInt(N);
    }

    void solve(PrintWriter out) {
        Arrays.sort(a);
        out.println(a[N - 1] - a[0]);
    }

}

class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

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

    public int[] arrayInt(int N) {
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = nextInt();
        }
        return array;
    }
}


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

using namespace std;
using ll = long long;
using ii = pair < int , int >;
using vi3 = pair < int , ii >;
using vi = vector < int >;
using vii = vector < ii >;

const int N = 2e5 + 5;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int n;
char s[12];

main(){
    scanf("%s" , s);
    int n = strlen(s);

    int mn = 10000;
    for(int i = 0 ; i < n - 2 ; i ++){
        int tmp = int(s[i] - '0')*100 + int(s[i+1] - '0')*10 + int(s[i+2] - '0');
        mn = min(mn , abs(tmp - 753));
    }
    printf("%d\n" , mn);

    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n; cin >> n; long a = 0;
  rep(i, n){
    long t = n / (i+1), u = (t+1)*t/2;
    a += (i+1) * u;
  }
  cout << a << "\n";
  return 0;
}

Measured memory_bytes: 3608
import collections

def breadth_first_search(g,check,length):
    q = collections.deque()
    q.append(1)
    check[1] = 1
    length[1] = 0
    while len(q) != 0:
        v = q.popleft()
        for u in g[v]:
            if check[u] == 0:
                check[u] = 1
                length[u] = length[v]+1
                q.append(u)

    return length

def main():
    N = int(input())
    g = []
    g.append([])
    for i in range(N):
        tmp = input().split()
        tmp_ls = []
        for i in range(int(tmp[1])):
            tmp_ls.append(int(tmp[i+2]))
        g.append(tmp_ls)

    check = [0]*(N+1)
    length = [0]*(N+1)
    ans = breadth_first_search(g,check,length)
    for i in range(N):
        node_num = i+1
        if ans[node_num] == 0 and i != 0:
            ans[node_num] = -1
        print(node_num,ans[node_num])

main()



Measured memory_bytes: 6036
package main

import (
	"fmt"
)

func main() {
	var (
		n   int
		sum float64
	)
	fmt.Scan(&n)
	a := make([]float64, n)
	for i := 0; i < len(a); i++ {
		fmt.Scan(&a[i])
		sum = sum + 1.0/a[i]
	}
	fmt.Println(1 / sum)
}


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

int main()
{
    int a,b,c,i,t;
    cin>>a>>b>>c;
    for(i=0;i<=a;i++){
        t=i*b+c;
        if(t%a==0){
            cout<<"YES"<<endl;
            exit(0);
        }
    }
    cout << "NO" << endl;
    return 0;
}


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

int main() {
	int n,m,a,b,i,cur=0,res;
	cin >> n >> m;
	set<int> x,y;
	for(i=0; i<m; i++){
		cin >> a >> b;
		if(a==1){
			x.insert(b); cur++;
		}else if(b==n){
			y.insert(a);
		}
	}
	auto itr=x.begin();
	for(i=0; i<cur; i++){
		res=y.count(*itr);
		if(res){
			cout << "POSSIBLE"; return 0;
		}
		itr++;
	}
	cout << "IMPOSSIBLE";
}


Measured memory_bytes: 9600
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define debug(s, param) std::cerr << s << param << std::endl;

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  int res = 0;
  for (int a = 1; a < n; ++a) {
    res += ((n - 1) / a);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <limits>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string a,b;
    cin >> a >> b;
    const double ab = stoi(a+b);
    if(floor(sqrt(ab)) == sqrt(ab))
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int cnt = 0;
        while(scn.hasNext()) {
            String str = scn.next();
            String rev = new String(new StringBuilder(str).reverse());
            if(str.equals(rev)) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 26156
k = gets.to_i

ans = 1
queue = [*1..9]

k.times do
  ans = queue.shift

  d = ans % 10

  queue << 10 * ans + d - 1 if d != 0
  queue << 10 * ans + d
  queue << 10 * ans + d + 1 if d != 9
end

puts ans


Measured memory_bytes: 3964
#include <cstdio>

int main()
{
  int n;
  scanf("%d", &n);
  int d = 0;
  for (int i = 0, nn = n; i < 9; ++i, nn /= 10)
  {
    d += nn % 10;
  }
  puts(n % d == 0 ? "Yes" : "No");
  return 0;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = line[0], b = line[1];

            Console.WriteLine(Math.Max(a+b, Math.Max(a-b, a*b)));
        }
    }
}

Measured memory_bytes: 13396
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	char s;
	
	rep(i,19){
		cin >> s;
		cout << (s==','?' ':s);
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
package main
	
import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc= bufio.NewScanner( os.Stdin )

func nextInt() int{
    sc.Scan()
    i, e := strconv.Atoi( sc.Text() )
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
	sc.Split( bufio.ScanWords )
	x := nextInt() 
	
	x3 := x * x * x
	
	fmt.Println( x3 )
	
}


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


int main() {
    int N;
    cin >> N;
    vector<int> W(N);
    for (int i=0; i<N; i++) {
        cin >> W[i];
    }
    
    int ans = 10000;
    
    int s = 0;
    int s1 = 0;
    int s2 = 0;
    
    for (int i=0; i<N; i++) {
        s += W[i];
    }
    
    for (int i=1; i<N; i++) {
        s1 = 0;
        for (int j=0; j<i; j++) {
            s1 += W[j];
        }
        s2 = s - s1;
        ans = min(ans, abs(s1-s2));
    }
    
    cout << ans << endl;
}

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

const int N = 1e5 + 5, mod = 1e9+7;
int n, a[N], pos[N];
using ll = long long;


ll quick_pow(ll a, ll b) {
    ll res = 1;
    a %= mod;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

int fac[N], finv[N];
void init_fac_mod(){
    //only when mod is prime
    fac[0] = finv[0] = 1;
    for(int i = 1; i <= N-1; ++i)
        fac[i]=(ll)fac[i-1]*i%mod;
    finv[N-1] = quick_pow(fac[N-1], mod-2);
    for(int i = N-2; i; --i)
        finv[i] = (ll)finv[i+1]*(i+1)%mod;
}

int c(int n, int m){
    //n!/(m!(n-m)!)
    return (ll)((ll)fac[n] * finv[m] % mod) * finv[n - m] % mod;
}


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n;
    init_fac_mod();
    int posdup, predup;
    for (int i = 1; i <= n+1; i++){
        cin>>a[i];
        if (pos[a[i]]!=0) {
            predup = pos[a[i]]-1;
            posdup = i;
        }
        pos[a[i]] = i;
    }
    
    int after_dup = n+1 -posdup;
    
    
    
    for (int k = 1; k <= n+1; k++){
        cout<<(c(n+1, k) - (k-1<=predup+after_dup?c(predup +after_dup, k-1):0) + mod)%mod<<endl;
    }
    
    
    
    
    
    return 0;
}




Measured memory_bytes: 2816
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;


int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int s1 = 0;
    int s2 = 0;
    int s3 = 0;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        if (t <= a) {
            ++s1;
        } else if (t <= b) {
            ++s2;
        } else ++s3;
    }
    cout << min(s1, min(s2, s3));
}





Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    string S; cin >> S;
    int N = S.length();
    for (int i = 0; i < N - 1; i++) {
        if (S[i] == 'A' && S[i + 1] == 'C') {
            printf("%s\n", "Yes");
            return 0;
        }
    }
    printf("%s\n", "No");
    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>

int main()
{
    int W, H, x, y, r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if (r <= x && x <= W - r)
    {
        if (r <= y && y <= H - r)    printf("Yes\n");
        else                         printf("No\n");
    }
    else    printf("No\n");

    return 0;
}

Measured memory_bytes: 584
n, m = map(int, input().split())
correct = [False] * n
correct_count = 0
wrong_each_count = [0] * n
wrong_count = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if correct[p - 1]:
        continue

    if s == 'AC':
        correct[p - 1] = True
        correct_count += 1
        wrong_count += wrong_each_count[p - 1]
    else:
        wrong_each_count[p - 1] += 1
print(correct_count, wrong_count)


Measured memory_bytes: 4596
#include<iostream>
#include<string>

using namespace std;

	int a,b,c;
	int i,j,k,sum;
	int arr[6] = {1,2,3,4,5,6};
	


void north(){
	
	int num;
	num = arr[0];
	arr[0] = arr[1];
	arr[1] = arr[5];
	arr[5] = arr[4];
	arr[4] = num;
	sum += arr[0];
	return;
}

void south(){
	
	int num;
	num = arr[0];
	arr[0] = arr[4];
	arr[4] = arr[5];
	arr[5] = arr[1];
	arr[1] = num;
	sum += arr[0];
	return;
}

void east(){
	
	int num;
	num = arr[0];
	arr[0] = arr[3];
	arr[3] = arr[5];
	arr[5] = arr[2];
	arr[2] = num;
	sum += arr[0];
	return;
}

void west(){
	
	int num;
	num = arr[0];
	arr[0] = arr[2];
	arr[2] = arr[5];
	arr[5] = arr[3];
	arr[3] = num;
	sum += arr[0];
	return;
}

void right(){
	
	int num;
	num = arr[1];
	arr[1] = arr[2];
	arr[2] = arr[4];
	arr[4] = arr[3];
	arr[3] = num;
	sum += arr[0];
	return;
}

void left(){
	
	int num;
	num = arr[1];
	arr[1] = arr[3];
	arr[3] = arr[4];
	arr[4] = arr[2];
	arr[2] = num;
	sum += arr[0];
	return;
}



int main(){
	
	string str;
	
	
	
	while(1){
		
		sum = 1;
		for(i=0 ; i<6 ; i++) arr[i] = i+1;
		
	
		cin >> a ;
	
		if(a ==0) break;
		
		for(j = 0 ; j < a ; j++){
		
			cin >> str;
			
			if(str == "North") north();
			else if(str == "East") east();
			else if(str == "West") west();
			else if(str == "South") south();
			else if(str == "Right") right();
			else if(str == "Left") left();
		}
		
		cout << sum << endl;
		
	}
		
		
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void)
{
 int N;
 int A[N];
 int i;
 int j;
 int true_false = 0;

 scanf("%d\n",&N);
 for(i=0;i<N;i++)
 {
  scanf("%d ",&A[i]);
 }
 for(i=0;i<N;i++)
 {
  if(A[i]%2 == 1)  j=j;
  else if((A[i]%3 != 0)&&(A[i]%5 != 0)) 
    {
    printf("DENIED\n");
    return 0;
    }
 }
 printf("APPROVED\n");


return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

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

   vector<ll> l(n+1);
   l[0] = 2, l[1] = 1;
   for(int i = 2; i <= n; i++){
      l[i] = l[i - 1] + l[i - 2];
   }
   cout << l[n] << endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	int n;
	cin >> n;
	vector<char>s(n);
	for (int i = 0; i < n; i++)cin >> s[i];
	bool p=0, w=0, g=0, y = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'P')p = true;
		else if (s[i] == 'W')w = true;
		else if (s[i] == 'G')g = true;
		else if (s[i] == 'Y')y = true;
	}
	int sum = p + w + g + y;
	if (sum == 4)puts("Four");
	else if (sum == 3)puts("Three");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int h, w;
    cin >> h >> w;
    int a[h][w];
    bitset<40000> dp[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) {
        int b;
        cin >> b;
        a[i][j] -= b;
        a[i][j] = abs(a[i][j]);
    }
    dp[0][0].set(20000 + a[0][0]);
    dp[0][0].set(20000 - a[0][0]);
    rep(i, h) rep(j, w) {
        if(j) dp[i][j] |= (dp[i][j - 1] << a[i][j]) | (dp[i][j - 1] >> a[i][j]);
        if(i) dp[i][j] |= (dp[i - 1][j] << a[i][j]) | (dp[i - 1][j] >> a[i][j]);
    }
    int ans = 1e9;
    rep(i, 40000) if(dp[h - 1][w - 1][i]) chmin<int>(ans, abs(20000 - i));
    cout << ans << endl;
}

Measured memory_bytes: 31616
import math
a,b,h,m=map(int,input().split())
xa=0.0
xb=0.0
hangle=(h*60+m)/(12*60)
mangle=m/60
#print(hangle,mangle)
#xa=a*math.sin(2*math.pi*hangle)
#xb=a*math.cos(2*math.pi*hangle)
#ya=b*math.sin(2*math.pi*mangle)
#yb=b*math.cos(2*math.pi*mangle)
#ans=math.sqrt((xa-xb)**2+(ya-yb)**2)
#print(ans)
ans2=math.sqrt(float(a)**2+float(b)**2-2*float(a)*float(b)*math.cos(2*math.pi*(hangle-mangle)))
print(ans2)
#print(1*float(a)*float(b)*math.cos(2*math.pi*(hangle-mangle)))

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

using namespace std;

#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef TurnRed
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	ll a, b;
	cin >> a >> b;
	ll g = __gcd(a, b);

	vector<ll> d;
	for (ll i = 1; i*i <= g; ++i)
		if (g % i == 0)
		{
			d.push_back(i);
			if (i*i != g)
				d.push_back(g/i);
		}

	int ans = 0;
	for (auto x : d)
	{
		bool ok = true;
		for (ll j = 2; j*j <= x; ++j)
			ok &= x % j != 0;
		ans += ok;
	}
	cout << ans << "\n";

	return 0;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)

int main()
{
    int n,m,c;
    cin>>n>>m>>c;
    int b[m],ans=0;
    ffor(i,0,m) cin>>b[i];
    ffor(i,0,n)
    {
        int a[m];
        ffor(j,0,m) cin>>a[j];
        int sum=0;
        ffor(j,0,m) sum+=a[j]*b[j];
        sum+=c;
        if(sum>0) ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define EPS 1e-15
#define f first
#define s second


int main(){
	string s;
	cin >> s;
	for(int i = 'a'-'0'; i <= 'z'-'0'; i++){
		if(!count(all(s), i + '0')){
			cout << char(i + '0') << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}






Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    ll A,B; cin>>A>>B;
    ll Gcd = __gcd(A,B);
    ll cnt=1;
    
    for (ll i = 2; i*i <= Gcd; ++i) {
        if(Gcd % i ==0){
            cnt++;
            while(Gcd % i == 0){
                Gcd /= i;
            }
        }
    }

    if(Gcd>1) cnt++;
    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int x, y, i;
    for(i=0; i>=0; i++){
        scanf("%d""%d", &x, &y);
        if( x==0 && y==0 ){
            break;
        }
        if(x>y)
        printf("%d %d\n", y, x);
        else
        printf("%d %d\n", x, y);
    }
    return 0;
}



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

using namespace std;

int p[4][2]={1,0,0,1,-1,0,0,-1};
int main()
{
    char a[60][60];
    int w,h;
    cin>>h>>w;
    getchar();
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>a[i][j];
        }
    }
    int f=1,flag;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(a[i][j]=='#')
            {
                 flag=1;
                for(int k=0;k<4;k++)
                {
                    int xx,yy;
                    xx=i+p[k][0];
                    yy=j+p[k][1];
                    if(xx<0 ||xx>=h || yy<0 || yy>=w)
                        {flag=0;continue;}
                    if(a[xx][yy]=='#')
                        flag=1;
                    else
                        flag=0;
                    if(flag) break;
                }
                if(flag==0)
                {
                    f=0;break;
                }

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


Measured memory_bytes: 256
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
 
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

X,Y,Z,K = gsmi
A = desc gsmi
B = desc gsmi
C = desc gsmi

ans = []
X.times do |x|
	Y.times do |y|
		break if (x+1)*(y+1) > K
		Z.times do |z|
			break if (x+1)*(y+1)*(z+1) > K
			ans << A[x] + B[y] + C[z]
		end
	end
end

puts desc(ans)[0...K]

Measured memory_bytes: 3832
n,k = int(input()),int(input())

l = len(str(n))

s = [0] + list(map(int,str(n))) #n=100の場合[0,1,0,0]みたいな感じ

if k > l:#n=10(l=2)でk=3とかだと該当する整数は存在しない
  print(0)
  exit()

dp = [[[0]*2 for _ in range(k+1)] for _ in range(l+1)]
#[0,0]を要素にもつ, k+1行l+1列の行列
#print(dp)

#dp[][][] の意味はdp[桁][k][0かどうかフラグ]


dp[0][0][1] = 1 #0行0列要素1
#print(dp)

for dig in range(l): #桁
  for i in range(k+1): 
    dp[dig+1][i][0] += dp[dig][i][0]
    dp[dig+1][i][1 if s[dig+1] == 0 else 0] += dp[dig][i][1]
    #sは先頭0, 桁ごとに分けたNのリスト e.g. N=123 -> [0,1,2,3]
    
    if i < k:
      dp[dig+1][i+1][0] += dp[dig][i][0] * 9
      if s[dig+1] > 0:
      	dp[dig+1][i+1][1] += dp[dig][i][1]
      	dp[dig+1][i+1][0] += dp[dig][i][1] * (s[dig+1]-1)

print(dp[l][k][0]+dp[l][k][1])

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	ll m,k;
	cin>>m>>k;
	if(m==1 && k==0) {
		cout<<"0 0 1 1\n";
	}else if(m==1 && k==1) {
		cout<<"-1\n";
	}else {
		ll mx=(1<<m)-1;
		if(k<=mx) {
			cout<<k<<" ";
			for(int i=0;i<=mx;++i) if(k!=i) cout<<i<<" ";
			cout<<k<<" ";
			for(int i=mx;i>=0;--i) if(k!=i) cout<<i<<" ";
			cout<<"\n";
		}else {
			cout<<"-1\n";
		}
	}
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#define LL long long
using namespace std;

LL N,S;

int main(){
    cin >> N >> S;

    if (S>N){
        cout << -1 << "\n";
        return 0;
    }
    else if (S==N){
        cout << N+1 << "\n";
        return 0;
    }

    LL i,aux,sum,res=-1,x;
    for (i=2; i*i<=N; i++){
        aux=N,sum=0;
        while (aux) sum+=aux%i,aux/=i;
        if (sum==S){ res=i; break; }
    }

    for (i=1; i*i<=N-S && S-i>=0; i++)
        if ((N-S)%i==0){
            x=(N-S)/i+1;
            if (x>i && x>S-i){
                if (res==-1) res=x;
                else res=min(res,x);
            }
        }

    if (res==-1) cout << -1 << "\n";
    else cout << res << "\n";

    return 0;
}


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


ll pow2_m(ll x, ll n, ll mod) {
 ll ans = 1ll;
 while (n > 0) {
  if ((n & 1) == 1) {
   ans = ans * x % mod;
  }
  x = x * x % mod;
  n >>= 1;
 }
 return ans;
}

void solve(){
	ll n;
	cin>>n;

	map<P,ll> mp;
	ll a0=0,b0=0,ab0=0;
	REP(i,n){
		ll a,b;
		cin>>a>>b;
		if(a==0&&b==0){
			ab0++;
			continue;
		}
		if(a==0){
			a0++;
			continue;
		}
		if(b==0){
			b0++;
			continue;
		}
		ll d=gcd(abs(a),abs(b));
		a/=d;
		b/=d;
		if(b<0){ a*=-1;b*=-1;}
		mp[{a,b}]++;
	}

	ll ans=1;
	for(auto& i:mp){
		auto [a,b]=i.first;
		ll x=i.second;
		if(x==0) continue;
		ll y=pow2_m(2,i.second,MOD);
		ll c=-b;
		ll d=a;
		if(d<0){c*=-1;d*=-1;}
		auto it=mp.find({c,d});

		if(it!=mp.end()){
			(y+=pow2_m(2,it->second,MOD)-1)%=MOD;
			it->second=0;
		}
		(ans*=y)%=MOD;
	}

	if(a0>0&&b0>0) (ans*=pow2_m(2,a0,MOD) + pow2_m(2,b0,MOD)-1)%=MOD;
	else if(a0>0) (ans*=pow2_m(2,a0,MOD))%=MOD;
	else if(b0>0) (ans*=pow2_m(2,b0,MOD))%=MOD;

	ans+=ab0;
	ans+=MOD-1;
	ans%=MOD;
	cout<<ans<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 16116
#include <stdio.h>

int main(void){

  int a,b,c;
  int i,s;

  scanf("%d%d%d\n",&a,&b,&c);

  s=0;

  for(i=a;i<=b;i++){
    if(c%i == 0){
      s=s+1;
    }
  }

  printf("%d\n",s);

  return 0;
}

Measured memory_bytes: 1852
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, K := sc.nextInt(), sc.nextInt()
	X := sc.nextIntSlice(N)
	ans := int(1e+9)
	for i := 0; i < N-K+1; i++ {
		l, r := X[i], X[i+K-1]
		count := min(abs(l)+abs(r-l), abs(r)+abs(r-l))
		if count < ans {
			ans = count
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
    const int MAX =200002;
const int MOD = 1000000007;

     signed main(){
   int k,a=7,ans=1;
   cin>>k;
   if(k%2==0 || k%5==0){
       cout<<-1<<endl;
       return 0;
   }
    while(a%k){
        a=(a*10+7)%k;
        ans++;
    }
    cout<<ans<<endl;
     }


 


 






    





      

        


Measured memory_bytes: 3632
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per0(i, st, ed) for (int i = (st); i > ed; --i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
#define chmin(a, b) (a = a > b ? b : a)
#define chmax(a, b) (a = a < b ? b : a)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
template<class T> void _out(const T &x) { cout << x; }
void _out(const int &x) { printf("%d", x); }
void _out(const ll &x) { printf("%lld", x); }
void _out(const double &x) { printf("%.16f", x); }
void _out(const char &x) { putchar(x); }
void _out(const char *x) { printf("%s", x); }
template<class T,class U> void _out(const pair<T,U> &x) {_out(x.F); putchar(' '); _out(x.S);}
template<class T> void _out(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _out(*i++)) if (i != x.cbegin()) putchar(' '); }
void out() {}
template<class T, class... U> void out(const T &head, const U &... tail) { _out(head); putchar(sizeof...(tail) ? ' ' : '\n'); out(tail...); }
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}


int main(){
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	int n;
	sf(n);
	int s = 0;
	while (s < n) {
		s += 1000;
	}
	out(s - n);
	return 0;
}

Measured memory_bytes: 3816
#coding: utf-8

nesw = {'N':0, 'E':1, 'S':2, 'W':3}
dirc = ((4, 0, 2, 3, 5, 1), (2, 1, 5, 0, 4, 3),
(1, 5, 2, 3, 0, 4), (3, 1, 0, 5, 4, 2))
dice = [0, 1, 2, 3, 4, 5]
temp = [0 for i in range(6)]

label = list(map(int, input().split()))
order = input()

for i in order:
    for j in range(6):
        temp[dirc[nesw[i]][j]] = dice[j]
    dice = temp[:]
print(label[dice[0]])


Measured memory_bytes: 5612