akhauriyash/Code-Regression huggingface dataset:
def main():
    from sys import stdin
    N = int(stdin.readline())
    P = 10**9+7
    
    def sieve_of_eratosthenes(upper_bound):
        upper_bound += 1
        P = [True] * upper_bound
        P[0] = P[1] = False
        for i in range(4,upper_bound,2):
            P[i] = False
        for i in range(3,int(upper_bound**0.5),2):
            if P[i]:
                for j in range(i**2,upper_bound,i):
                    P[j] = False
        res = []
        for i in range(upper_bound):
            if P[i]:
                res.append(i)
        return res
    
    primes = sieve_of_eratosthenes(N)
    num_p = [0]*len(primes)

    ans = 1
    for i in range(2,N+1):
        for j,p in enumerate(primes):
            while i % p == 0:
                i //= p
                num_p[j] += 1
            if i == 1:
                break
            
    ans = 1
    for p in num_p:
        ans = ans * (p+1) % P
    print(ans)
main()



        



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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n, c, k, t[maxn];

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

	cin >> n >> c >> k;
	for (int i = 0; i < n; i++)
		cin >> t[i];
	sort(t, t + n);
	
	int ans = 0, last = t[0], count = 1;
	for (int i = 1; i < n; i++)
	{
		count++;
		if (count == c + 1 || t[i] - last > k)
		{
			last = t[i];
			count = 1;
			ans++;
		}
	}
	if (c)
		ans++;
	cout << ans << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 2000000000;

int a,b;
char c;

int main(){
  cin >> a >> c >> b;
  if(c == '-') cout << a-b <<endl;
  else cout << a+b <<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,s,t;
int main(){
	s=t=0;
	for(int i=0;i<4;i++){
		cin >> n;
		s+=n;
	}
	for(int i=0;i<4;i++){
		cin >> n;
		t+=n;
	}
	if(s>t){
		cout << s <<endl;
	}else{
		cout << t <<endl;
	}
	return 0;
}

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

using namespace std;

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

int main() {
  int h, w, m;
  cin >> h >> w >> m;
  set<pair<int, int>> st;
  int hmaxval = 0, wmaxval = 0;
  vector<int> hs(h);  // hの爆弾の数
  vector<int> ws(w);  // wの爆弾の数
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    st.insert({x, y});
    hs[x]++;
    chmax(hmaxval, hs[x]);
    ws[y]++;
    chmax(wmaxval, ws[y]);
  }
  vector<int> hmax;
  vector<int> wmax;
  for (int i = 0; i < h; i++) {
    if (hmaxval == hs[i]) {
      hmax.push_back(i);
    }
  }
  for (int i = 0; i < w; i++) {
    if (wmaxval == ws[i]) {
      wmax.push_back(i);
    }
  }
  int ans = hmaxval + wmaxval - 1;
  for (auto x : hmax) {
    for (auto y : wmax) {
      if (st.find({x, y}) == st.end()) {
        cout << ans + 1 << endl;
        return 0;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 23800
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
ans_o = float("inf")
for i in range(n):
    o = t - h[i] * 0.006
    if ans_o > abs(a-o):
        ans = i
        ans_o = abs(a-o)
print(ans+1)

Measured memory_bytes: 3064
#include <iostream>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
  char c;
  string s = "aeiou";

  cin >> c;

  if(s.find(c) != string::npos) {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        long count =0;
        long kazu=0;
        long number=100;
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        long n=Long.parseLong(a);
        while (true){
          number=(long)(1.01*number);
          //System.out.println(number);
          count++;
          if(number>=n){
              break;
          }
        }
        System.out.println(count);
    }
}



Measured memory_bytes: 35700
def cumsum(inlist,r = 0):
    s = 0
    outlist = []
    if r == 1:
        inlist.reverse()
    for i in inlist:
        s += i
        outlist.append(s)
    if r == 1:
        outlist.reverse()
    return outlist

n = int(input())
s = input()

w_list = [ 1 if i == "." else 0 for i in s ]
b_list = [ 1 if i == "#" else 0 for i in s ]

cum_w_list = cumsum(w_list,1)
cum_b_list = cumsum(b_list)

ans_list = [ s.count(".") ] + [ cum_b_list[i] + cum_w_list[i+1] for i in range(n-1) ] + [ s.count("#") ]

print( min(ans_list) )

Measured memory_bytes: 72500
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		FastScanner fs = new FastScanner();
		String S = fs.next();
		String pattern = "^(hi)+$";
		//Pattern p = Pattern.compile(pattern);

		if(S.matches(pattern)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


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

Measured memory_bytes: 21716
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

s = input()
a = 0<int(s[:2])<13
b = 0<int(s[2:])<13
if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function Main(input){
    var args = input.split('\n');
    var N = parseInt(args[0], 10);
    var a = args[1].split(' ').map(a => parseInt(a, 10)).sort( (a,b) => (a<b ? -1 : 1) );

    console.log(a[N-1]-a[0]);
}

Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9+7;
struct edge{ll x,y;};
struct huga{ll honest; bool done;};
using namespace std;

vector<int>binary(ll temp){
    vector<int>s;
        while(temp){
            temp--;
            s.push_back(temp%2);
            temp = temp / 2;
        }
    return s;
}

ll calc(ll n){
    if((n+1) % 2 == 0){
      return (( n+ 1) / 2) % 2;
    }
    else{
        int cntone = (n/2)%2;
        return cntone ^ n;
        }

}




int main(){
    ll a,b;
    cin >> a >> b;
    ll ans;
    ans = calc(b) ^ calc(a-1);
    cout << ans << endl;

    
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 1e5 + 7;
int a, b, c;

int main() {
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	printf("%d %d %d\n", a, b, c);
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)

using namespace std;
using lint = long long;

int main(void)
{
    int N;
    cin >> N;
    vector<int> d(N);
    rep(i, N) cin >> d[i];
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    int cnt[5] = {};
    rep(i, n)
    {
        string s;
        cin >> s;
        if (s[0] == 'M')
            cnt[0]++;
        if (s[0] == 'A')
            cnt[1]++;
        if (s[0] == 'R')
            cnt[2]++;
        if (s[0] == 'C')
            cnt[3]++;
        if (s[0] == 'H')
            cnt[4]++;
    }
    int ans = 0;
    rep(i, 5) Rep(j, i + 1, 5) Rep(k, j + 1, 5)
    {
        ans += cnt[i] * cnt[j] * cnt[k];
    }
    cout << ans << endl;
}

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

struct UF{
    int N,par[10000],sz[10000];

    void init(int _N){
        N=_N;
        for(int i=0;i<N;i++){
            par[i]=i;
            sz[i]=1;
        }
    }

    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }

    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        if(sz[x]<sz[y])swap(x,y);
        par[y]=x;
        sz[x]+=sz[y];
    }

    bool isSame(int x,int y){
        return find(x)==find(y);
    }
};

typedef pair<int,int>P;
typedef pair<int,P>PP;
int main(){
    int N,M;
    cin>>N>>M;

    vector<PP>es;

    for(int i=0;i<M;i++){
        int s,t,w;
        cin>>s>>t>>w;
        es.push_back(PP(w,P(s,t)));
    }

    sort(es.begin(),es.end());

    UF uf;
    uf.init(N);
    int ans=0;
    for(int i=0;i<M;i++){
        PP p=es[i];
        if(uf.isSame(p.second.first,p.second.second))continue;
        ans+=p.first;
        uf.unite(p.second.first,p.second.second);
    }

    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int n;
    bool det = true;
    cin >> n;
    int t =  n / 1.08;
    if((int)(t*1.08) != n){
        t++;
        if((int)(t*1.08) != n) det = false;
    }
    if(det){
        cout << t << endl;
    }else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
S = input()
result = ["0"]
hoge = []

i=0
while( i<len(S)-1 ):
    hoge = S[i]
    if result[-1] == hoge :
        result.append(S[i]+S[i+1])
        i+=1
    else:
        result.append(S[i])
    i+=1

#最後の一文字
if len(S)!=i:
    if result[-1]==S[-1]:
        result[-1]+=S[-1]
    else:
        result.append(S[-1])

print(len(result)-1)

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




namespace ConsoleApplication1 {

    

    class ClassMain {


        


        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = ints[0];
                int n = int.Parse(line);                
                if (n == 0) { break; }
                int S = 0;
                if (n == 1) { Console.WriteLine("deficient number"); continue; }
                for (int i = 1; i * 2 <= n; i++) {
                    if (n % i == 0) { S += i; }
                }
                
                
                string str = "";
                if (n == S) { str = "perfect number"; }
                else if (n > S) { str = "deficient number"; }
                else { str = "abundant number"; }
                Console.WriteLine(str);
                    
                



            }
        }
    }
}

Measured memory_bytes: 5284
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

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

Measured memory_bytes: 256
n = int(input())

taro_score = 0
hanako_score = 0
for i in range(n):
	words = input().split()
	taro_word = words[0]
	hanako_word = words[1]

	if taro_word == hanako_word:
		taro_score += 1
		hanako_score += 1
	elif taro_word > hanako_word:
		taro_score += 3
	else:
		hanako_score += 3

print("{0} {1}".format(taro_score, hanako_score))

Measured memory_bytes: 7652
import java.util.Scanner;

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

        int N = scanner.nextInt();
        int ans = 0;

        if (N < 1000) {
            ans = 1000 - N;
        } else if (N % 1000 == 0){
            System.out.println(0);
            System.exit(0);
        } else {
            String t = String.valueOf(N);
            char c = t.charAt(0);
            int thousand = Character.getNumericValue(c)*1000;
            ans = 1000 - (N - thousand);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 27156
while True:
    counter = int(input())
    if counter == 0:
        break
    deliv_price = 0
    for i in range(0,counter):
        data = input().split(" ")
        size = int(data[0]) + int(data[1]) + int(data[2])
        weight = int(data[3])

        if size <= 60 and weight <= 2:
            deliv_price += 600
        elif size <= 80 and weight <=5:
            deliv_price += 800
        elif size <= 100 and weight <=10:
            deliv_price += 1000
        elif size <= 120 and weight <=15:
            deliv_price += 1200
        elif size <= 140 and weight <=20:
            deliv_price += 1400
        elif size <= 160 and weight <=25:
            deliv_price += 1600
    print(deliv_price)


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

int main() {
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;

    if (s == u) a--;
    if (t == u) b--;

    cout << a << ' ' << b << endl;
    return 0;
}


Measured memory_bytes: 256
s=input()
while len(s)>=5:
  if len(s)<=9:
    if s=='dream' or s=='dreamer' or s=='erase' or s=='eraser':
      print('YES')
      exit()
    else:
      print('NO')
      exit()
  else:
    if s[0:5]=='dream':
      s=s[5:]
      if s[0:2]=='er' and s[2]!='a':
        s=s[2:]
    elif s[0:5]=='erase':
      if s[5]=='r':
        s=s[6:]
      else:
        s=s[5:]
    else:
      print('NO')
      exit()
  

Measured memory_bytes: 3188
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)

#dp[i][j]: iまでからj枚えらんで和がkになるのは何通り
def main():
	a,b = map(int,input().split())
	if(a<b):
		print(0)
	else:
		print(10)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Measured memory_bytes: 64560
#![allow(non_snake_case)]

use std::cmp;

#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

struct Solver {
    W: Vec<i64>,
    V: Vec<i64>,
    memo: Vec<Vec<Option<i64>>>,
}

impl Solver {
    fn new(W: Vec<i64>, V: Vec<i64>) -> Self {
        Solver {
            W: W,
            V: V,
            memo: vec![vec![None; 100001]; 101],
        }
    }

    /// i個までで重さj以下
    fn f(&mut self, i: i64, j: i64) -> i64 {
        if i == 0 { return 0; }

        if self.memo[i as usize][j as usize].is_none() {
            let w = self.W[(i-1) as usize];  // 現在の品物の重さ
            let v = self.V[(i-1) as usize];  // 現在の品物の価値

            let mut res = self.f(i-1,j);  // 現在の品物を選ばない場合
            if w <= j {
                res = cmp::max(res, v + self.f(i-1,j-w));  // 現在の品物を選ぶ場合
            }
            self.memo[i as usize][j as usize] = Some(res);
        }
        self.memo[i as usize][j as usize].unwrap()
    }
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let N    = sc.value::<i64>();
    let WMAX = sc.value::<i64>();
    let mut W = Vec::with_capacity(N as usize);
    let mut V = Vec::with_capacity(N as usize);
    for _ in 0..N {
        W.push(sc.value::<i64>());
        V.push(sc.value::<i64>());
    }

    let mut sol = Solver::new(W, V);
    let ans = sol.f(N, WMAX);

    println!("{}", ans);
}


Measured memory_bytes: 211196
N, A, B = map(int, input().split())
H = [0] * N
for i in range(N):
    H[i] = int(input())

sorted_H = sorted(H, reverse=True)

def is_enough(num):
    cnt = 0
    for x in range(N):
        if sorted_H[x] - num * B > 0:
            cnt += (sorted_H[x] - num * B) // (A - B)
            if (sorted_H[x] - num * B) % (A - B) != 0:
                cnt += 1
        else:
            break
    return cnt <= num

limit = (sorted_H[0] // B) + 1

i = 0
j = limit
while True:
    k = (j + i) // 2
    if is_enough(k):
        if i + 1 == k:
            print(k)
            break
        j = k
    else:
        if k + 1 == j:
            print(k + 1)
            break
        i = k


Measured memory_bytes: 49880
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#include <climits>
#include <memory>
#include <numeric>
#include <utility>


#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
#define PI 3.14159265358979323846264338327950L;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;



int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int D;
ll G;
vector<ll> P, C;

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

	int D, G;
	cin >> D >> G;

	if (D%G == 0)cout << 0 << endl;
	else cout << 1 << endl;


}
	

Measured memory_bytes: 256
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<vector<int>> g(n,vector<int>(n,-1));
    
    for(int i = 0;i < n;i++){
          int a;
          cin >> a;
          for(int j = 0;j < a;j++){
                int x,y;
                cin >> x >> y;
                x--;
                g[i][x] = y;
          }
    }
    
    int ans = 0;
    
    for(int i = 0;i < 1 << n;i++){
          bool ok = true;
          int t = __builtin_popcount(i);
          
          for(int j = 0;j < n;j++){
                if(i >> j & 1){
                      for(int k = 0;k < n;k++){
                            if(g[j][k] == -1)continue;
                            if(g[j][k] != (i >> k & 1)){
                                  ok = false;
                            }
                      }
                }
          }
          if(ok)ans = max(ans,t);
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

const int MOD = 1e9 + 7;

int main(){

    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }

    vector<int> rest(N);
    rest[N - 1] = 0;
    for(int i = N - 2; i >= 0; i--){
        rest[i] = rest[i + 1] + a[i + 1];
    }

    vector<long long> before(K + 2, 1);
    vector<long long> next(K + 2);

    before[0] = 0;
    next[0] = 0;

    for(int i = 0; i < N; i++){
        int temp = a[i];
        int lower = max(0, K - rest[i]);
        for(int j = 0; j < lower; j++){
            next[j + 1] = 0;
        }

        for(int j = lower; j <= K; j++){
            
            next[j + 1] = (next[j] + (before[j + 1] - before[max(0, j - temp)] + MOD)) % MOD;
        }

        // for(int j = 0; j < K + 2; j++){
        //     cout << next[j] << " ";
        // }
        // cout << endl;

        swap(before, next);
    }

    cout << before[K + 1] << endl;

    return 0;
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var strs = Console.ReadLine().Split();
            var A = int.Parse(strs[0]);
            var B = int.Parse(strs[1]);

            Console.WriteLine(A * B - (A + B - 1));
        }
    }
}


Measured memory_bytes: 13140
n = int(input())
nums = map(int, input().split())

max = -1000000
min = 1000000
sum = 0

for num in nums:
    sum += num
    if num > max:
        max = num
    if num < min:
        min = num
print("{0} {1} {2}".format(min, max, sum))

Measured memory_bytes: 8324
#include<iostream>
#include<vector>
#include<iterator>

using namespace std;

int main(){
    int N;
    int A[200000];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    int left=0;
    int right=0;
    long ans=0;
    int key=0;
    while(right<N){
        int tmp = key xor A[right];
        if( (tmp & key) == key){
            right++;
            ans += (long) (right-left);
            key=tmp;
        }else{
            key=key xor A[left];
            left++;
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int W, N; cin >> W >> N;
	vector<int>nums(W);
	iota(nums.begin(), nums.end(), 1);
	while (N--) {
		int a, b;
		scanf("%d,%d", &a, &b);
		a--; b--;
		swap(nums[a], nums[b]);
	}
	for (int i = 0; i < W; ++i)cout << nums[i] << endl;
	return 0;
}

Measured memory_bytes: 3132
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

li rec(const li dist, const li rem, const bool istop) {
    if (dist < 0) {
        return rem == 0;
    } else if (dist == 0) {
        return (rem == 0) * (10 - istop);
    }

    li unit = 1;
    for (int i = 0; i < dist; ++i) {
        unit *= 10;
    }
    unit -= 1;

    li ans = 0;
    for (int v = -9; v <= 9; ++v) {
        const li nrem = rem - unit * v;
        if (nrem % 10 == 0) {
            ans += (10 - istop - abs(v)) * rec(dist - 2, nrem / 10, false);
        }
    }
    return ans;
}

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

    li d;
    cin >> d;

    li ans = 0;
    for (int digits = 1; digits <= 25; ++digits) {
        ans += rec(digits, d, true);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include<string.h>
int top,S[1000];
void push(int x)
{
  S[++top] = x;
} 
int pop()
{
  top--;
  return S[top+1];
}
int main()
{
    int a,b;
    char s[100];
    while(scanf("%s",s) != EOF)
    {
      if(s[0] == '+')
       {
         a = pop();
         b = pop();
         push(a+b);
       }
       else if(s[0] == '-')
       {
         b = pop();
         a = pop();
         push(a-b);
       }
       else if(s[0] == '*')
       {
         a = pop();
         b = pop();
         push(a*b);
       }
       else push(atoi(s));
    }
    printf("%d\n",pop());
    return 0;
}



Measured memory_bytes: 2724
#include<bits/stdc++.h>
#define for_int(i,a,b) for(int i=(a);i<=(b);++i)
#define rep_int(i,a,b) for(int i=(a);i>=(b);--i)
#define for_ll(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep_ll(i,a,b) for(ll i=(a);i>=(b);--i)
#define IOS ios::sync_with_stdio(false);
#define ull unsigned long long
#define ll long long
#define db double
#define HPMAX 1005
#define KMP_MAX 1005
#define prime_MAX 1000005
#define quick_pow_mod 1000000007
#define PII pair<int,int>
const int factor_N = 10000005;
const int tree_arr_N = 1000005;
using namespace std;
/*
	1.注意边界情况
	2.优先考虑时间复杂度
!!! 3.求最大值时，答案应至多初始化为INT_MIN；求最小值时，答案应至少初始化为INT_MAX
	4.遇事不决先暴力
	5.代码要写简洁
*/
//快读
int read() {
	char c = getchar();
	int x = 0, f = 1;
	for (; !isdigit(c); c = getchar())
		if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
	return x * f;
}
int x;
int main() {
	x = read();
	if (x == 0) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3616
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 2e5 + 5;

typedef long long ll;

long long n, ans, p[27][N];
char s[N];

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

      for(int i = 1; i <= 26; i ++){
            for(int j = n; j >= 1; j --){
                  if(s[j] - 'a' + 1 == i) p[i][j] ++;
                  p[i][j] += p[i][j + 1];
            }
      }

      for(int i = 1; i <= n; i ++){
            ans += (n - i + 1) - p[s[i] - 'a' + 1][i];
      }

      cout << ans + 1 << endl;
}


Measured memory_bytes: 41088
def search(S,T):
    match = 0
    maxmatch = 0
    maxmatchloc = -1
    for x in range(len(S)-(len(T)-1)):
        match = 0
        if (S[x] == T[0] or S[x] == '?'):
            for i in range(0,len(T)):
                ##print(S[x+i] + '-' + T[i])
                if (S[x+i] == T[i] or S[x+i] == "?"):
                    match += 1
                else:
                    ##print("Entered!")
                    match = 0
                    break
            if (match >= maxmatch and match != 0):
                ##print("ENTERED")
                maxmatchloc = x
                maxmatch = match
        ##print('At x = ' + str(x) + ': maxmatchlocation is ' + str(maxmatchloc) + ' match is ' + str(match) + ' maxmatch is' + str(maxmatch))
    return maxmatchloc

S = input()
T = input()
code = S
if '?' in S:
    if (len(T) <= len(S)):
        startpoint = search(S,T)
        for x in range(len(S)):
            if (S[x] == '?'):
                code = code[:x] + 'a' + code[x+1:] 
        if(startpoint >= 0):
            code = code[:startpoint] + T + code[startpoint + len(T):]
            print(code)
        else:
            print('UNRESTORABLE')
    else:
        print('UNRESTORABLE')
else:
    print(S)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int N, x;
	cin >> N >> x;
	int a[ N ];
	for( int i = 0; i < N; ++i )
	{
		cin >> a[ i ];
	}
	long long ans = 0;
	for( int i = 0; i < N; ++i )
	{
		if( i + 1 >= N ) continue;

		for( int j = 1; j >= 0; --j )
		{
			if( a[ i ] + a[ i + 1 ] <= x ) break;

			int over = a[ i ] + a[ i + 1 ] - x;

			int eat = min( a[ i + j ], over );

			a[ i + j ] -= eat;

			ans += eat;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  string a,b,c;cin>>a>>b>>c;
  if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n;
   cin >> n;

   cout << "ABC";
   cout << n;
   cout << endl;


   return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    readLine()!!
    val list: List<Int> = readLine()!!.split(" ").map { it.toInt() }.distinct()
    readLine()!!
    val list2: List<Int> = readLine()!!.split(" ").map { it.toInt() }.distinct()
    var match:Int = 0
    for (i in (0..list.count()-1))
    {
        for (j in (0..list2.count()-1))
        {
            if (list[i]==list2[j])
            {
                match++
                continue
            }
        }
    }
    println(match)
}



Measured memory_bytes: 37808
#include <iostream>
#include <cstdio>
#define N 305
using namespace std;
 
int n, c;
bool v;
string a[N];
int main()
{
	int i, j, k;
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i], a[i] += a[i];
	for (i = 0; i < n; i++) {
		for (j = v = 0; j < n; j++) {
			for (k = 0; k < n; k++) if (a[j][k + i] != a[k][j + i]) {v = 1; break;}
			if (v) break;
		}
		if (!v) c++;
	}
    cout << c * n << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
const ll INF = 1LL << 60;
#define MOD 1000000007
#define MAX_V 100010
#define MAX_N 100010

bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}

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

ll junnretu(ll n){
    ll ans=1;
    for (ll i=1;i<=n;i++){
        ans*=i;
    }
    return ans;
}

int main(){
    ll n;
    ld ans=0;
    cin >> n;
    for (ll i=0;i<n;i++){
        ld x;
        string s;
        cin >> x >> s;
        if (s=="JPY"){
            ans+=x;
        }else{
            ans+=x*380000;
        }
    }
    cout << ans << endl;
    return 0;
}






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

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

  int N;
  cin >> N;

  string S;
  cin >> S;

  int ans = 1;
  char s = S[0];
  for(int i = 1; i < S.size(); i++) {
    if(S[i] != s) {
      s = S[i];
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3756
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	for(int i=0;i<N;i++){
	    X[i] = sc.nextInt();
	}
	//Arrays.sort(X);
	int min = Integer.MAX_VALUE;
	for(int p=1; p<=100; p++){
	    int count = 0;
	    for(int j=0;j<N;j++){
		count += (X[j] - p)*(X[j] - p);
	    }
	    if(count < min) min = count;
	}
	System.out.print(min);
    }
}


Measured memory_bytes: 23764
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int l=-1000,s=1000;
int main()
{
    int n,m;
    int x,y;
    cin>>n>>m>>x>>y;
    int a[n+1];
    int b[m+1];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<m;i++)
        cin>>b[i];
    a[n]=x;
    b[m]=y;
    for(int i=0;i<=n;i++)
        l=max(l,a[i]);
    for(int i=0;i<=m;i++)
        s=min(s,b[i]);
    if(s-l>=1)cout<<"No War";
    else cout<<"War";
    
system("pause");
return 0;
}

Measured memory_bytes: 504
use std::f64::consts::PI;
fn main() {
  proconio::input!{a:f64,b:f64,h:f64,m:f64};
  let mut c=(h*30.+m*0.5).abs()-(m*6.);
  if 180.<=c{c=360.-c}
  println!("{}",(a*a+b*b-2.*a*b*c.to_radians().cos()).sqrt())
}

Measured memory_bytes: 2924
A = list()
for _ in range(3):
  for i in map(int, input().split()):
    A.append(i)
N = int(input())
B = list()
for i in range(N):
  B.append(int(input()))
c = [0 for i in range(9)]
for i in range(N):
  for j in range(9):
    if B[i] == A[j]:
      c[j] += 1
#print(c)
if (c[0]*c[1]*c[2] != 0) or (c[3]*c[4]*c[5] != 0) or (c[6]*c[7]*c[8] != 0) or (c[0]*c[3]*c[6] != 0) or (c[1]*c[4]*c[7] != 0) or (c[2]*c[5]*c[8] != 0) or (c[0]*c[4]*c[8] != 0) or (c[2]*c[4]*c[6] != 0):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
package main

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

var (
	graph [][]bool
	seen []bool
)

func dfs(a, b, now int) {
	if seen[now] {
		return
	}
	seen[now] = true

	for next, tf := range graph[now] {
		if !tf {
			continue
		}
		if (now == a && next == b) || (now == b && next == a) {
			continue
		}

		dfs(a, b, next)
	}
}

func solve() {
	n, m := getInt(), getInt()
	graph = make([][]bool, n)
	for i := range graph {
		graph[i] = make([]bool, n)
	}
	for i := 0; i < m; i++ {
		a, b := getInt()-1, getInt()-1
		graph[a][b] = true
		graph[b][a] = true
	}
	seen = make([]bool, n)

	ans := 0
	for a := range graph {
		for b := range graph[a] {
			if graph[a][b] && a < b {
				dfs(a, b, 0)
				for i := range seen {
					if !seen[i] {
						ans++
						break
					}
				}
			}
			
			for i := range seen {
				seen[i] = false
			}
		}
	}

	fmt.Fprintln(wr, ans)
}

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

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

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

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


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

int main()
{
  int A, B, C, K;
  cin>>A>>B>>C>>K;
  if(K<=A)
    cout<<K;
  else if(K<=(A+B))
    cout<<A;
  else
    cout<<((2*A)+B-K);
  return 0;
}

Measured memory_bytes: 3604
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        
        out.println(a * b % 2 == 0 ? "Even" : "Odd");
        out.close();
        
    }
}

Measured memory_bytes: 32532
N = int(input())

c_max = 0
i_max = 1
for i in range(1, N+1):
    c = 0
    num = i
    while True:
        if num % 2 != 0:
            break
        num = num // 2
        c += 1
    if c > c_max:
        c_max = c
        i_max = i
        
print(i_max)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;


int main ()
{
    int x,y;
    cin>>x>>y;
    int a=x+y;
    int b=x-y;
    int c=x*y;
    if (a>=b&&a>=c)
        cout<<a;
    else if (b>=a&&b>=c)
        cout<<b;
    else if (c>=a&&c>=b)
        cout<<c;

}


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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll N;
ll P[200010];
ll mn;
ll ans;
int main(){
	cin >> N;
	REP(i,0,N) cin >> P[i];
	mn = inf;
	REP(i,0,N){
		mn = min(P[i], mn);
		if(mn == P[i]){
			ans++;
		}
	}
	p(ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <map>
#include <queue>
#include <tuple>
#include <math.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef tuple<int,int,int> P;


int main(){
    ll X;
    cin >> X;
    unsigned long long money=100;
    unsigned long long ans=0;
    while(money<X){
        money+=money/100;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define dame {cout<< "NO" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    vector<ll> x(N);
    vector<ll> y(N);
    vector<ll> h(N);

    rep(i,N) cin>>x[i]>>y[i]>>h[i];

    rep(xx,101){
        rep(yy,101){
            ll tyuh;
            rep(i,N){
                if(h[i]!=0) tyuh=h[i]+abs(x[i]-xx)+abs(y[i]-yy);
            }
            bool ok=true;
            rep(i,N){
                if(h[i]!=max(0LL,tyuh-(abs(x[i]-xx)+abs(y[i]-yy)))) ok=false; 
            }
            if(ok){
                cout<< xx <<" "<< yy <<" "<< tyuh <<"\n"; return;
            }
        }
    }

}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            ReadString();
            var A = ReadLongArray();

            long sum = 0;
            long total = A.Sum();
            long minDiff = total;
            for (int i = 0; i < A.Length; i++)
            {
                sum += A[i];
                long diff = Abs(sum - (total - sum));
                if (diff < minDiff)
                {
                    minDiff = diff;
                }
            }

            Console.WriteLine(minDiff);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 39248
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;


std::vector<vector<int>> neighbours;
std::vector<int> ans;
std::vector<bool> visited;

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

    int n,m; cin >> n >> m;
    neighbours = vector<vector<int>>(n, vector<int>());
    ans = std::vector<int>(n,-1);
    visited = std::vector<bool>(n,false);
    rep(i,m){
        int a,b; cin >> a >> b; --a; --b;
        neighbours[a].push_back(b);
        neighbours[b].push_back(a);
    }

    queue<int> q;
    q.push(0);

    while(!q.empty()){

        int k = q.front(); q.pop();

        for(int i=0; i<neighbours[k].size(); i++){
            int next = neighbours[k][i];

            if(visited[next]) continue;

            ans[next] = k;
            visited[next] = true;

            q.push(next);
        }

    }
    cout << "Yes" << endl;

    rep(i,n-1) cout << ans[i+1]+1 << endl;



    return 0;
}

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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;

int mod(int a){
	a = (a + 27) % 27;
	return a;
}

void putmin(int &a, int b){
	a = min(a, b);
}

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

#ifdef MARX
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif

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

	vector<vi> nxt(n, vi(27, oo));

	for (int i = n - 1; i >= 0; --i){

		int x = s[i] - 'a';
		nxt[i][x] = i + 1;

		for (int j = 0; j < 26; ++j){
			if ( nxt[i][mod(x + j)] < n && mod(x + j + 1) != 0){
				nxt[i][mod(x + j + 1)] = nxt[ nxt[i][mod(x + j)] ][ mod(x + j) ];
			}

			if ( nxt[i][26] < n )
				putmin( nxt[i][ mod(x + j + 1) ], nxt[ nxt[i][26] ][ mod(x + j + 1) ] );
		}
	}

	vector<vi> go(1, vi(n, oo));

	bool some = false;

	for (int i = 0; i < n; ++i){
		go[0][i] = nxt[i][26];
		if (go[0][i] <= n) some = true;
	}

	while (some){
		some = false;
		vi ngo(n, oo);

		for (int i = 0; i < n; ++i){
			if (go.back()[i] < n){
				some = true;
				ngo[i] = go.back()[ go.back()[i] ];
			} 
		}

		go.push_back( ngo );
	}

	int q; cin >> q;

	while (q--){
		int b, e;
		cin >> b >> e;
		b--;

		for (int i = go.size() - 1; i >= 0 && b < e; --i)
			while (b < e && go[i][b] <= e) b = go[i][b];

		cout << (b == e ? "Yes" : "No") << endl;
	}

	return 0;
}

Measured memory_bytes: 116344
count_divisor :: Int->Int->Int->Int->Int

count_divisor a b c num_divisor =
  if a > b then
    num_divisor 
  else
    if (c `mod` a) == 0 then
      count_divisor (a + 1) b c (num_divisor + 1)
    else
      count_divisor (a + 1) b c num_divisor

toInt x = read x :: Int

main = do
  s <- getLine
  let [a, b, c] = map toInt . words $ s

  let num_divisor = count_divisor a b c 0

  putStrLn (show num_divisor)

Measured memory_bytes: 3992