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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll A[100];
int main(){
    int N;
    cin >> N;
    ll ma = -100000000;
    ll mi = 100000000;
    int mai;
    int mii;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        if(ma < a) {
            ma = a;
            mai = i;
        }
        if(mi > a) {
            mi = a;
            mii = i;
        }
    }

    cout << 2*N-1 << endl;
    ll T;
    if(ma >= 0 && mi <= 0){
        ll x;
        int y;
        bool pos;
        if(abs(ma) > abs(mi)){
            x = ma;
            y = mai;
            pos = true;
        }
        else{
            x = mi;
            y = mii;
            pos = false;
        }
        for(int i = 0; i < N; i++){
            printf("%d %d\n", y+1, i+1);
        }
        if(pos){
            for(int i = 1; i < N; i++)
                printf("%d %d\n", i, i+1);
        }
        else{
            for(int i = N-1; i > 0; i--)
                printf("%d %d\n", i+1, i);
        }
    }
    else if(ma >= 0 && mi >= 0){
        ll x = ma;
        int y = mai;
        for(int i = 0; i < N; i++){
            printf("%d %d\n", y+1, i+1);
        }
        for(int i = 1; i < N; i++)
            printf("%d %d\n", i, i+1);
    }
    else{
        ll x = mi;
        int y = mii;
        for(int i = 0; i < N; i++){
            printf("%d %d\n", y+1, i+1);
        }
        for(int i = N-1; i > 0; i--)
            printf("%d %d\n", i+1, i);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    #define PAIN___ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define ll long long int
    #define fi first
    #define se second
    #define pb push_back
    #define pii pair < ll, ll >
    #define mp make_pair
    #define vec vector < ll >
    #define vecp vector < pii  >
    #define forl(i,q1,n,q2) for(ll i=q1;i<q2;i++)
    #define null NULL
    #define mm 100005
   /* string with spaces   getline(cin,s);*/

int main(){
    PAIN___;
	ll n,d;
	cin>>n>>d;
	ll a,b;
	a=1,b=d+1+d;
	//cout<<b<<endl;
	ll sum[101];
	sum[0]=b;

	forl(i,1,n,100)
	{
	    sum[i]=sum[i-1]+b;
	}
	//forl(i,0,n,100)cout<<sum[i]<<endl;
	//cout<<sum[2]<<endl;
	forl(i,0,n,100)
	{
	    if(sum[i]>=n){cout<<i+1<<endl;break;}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)


int main(){
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int dv[] = {x2 - x1,y2 -y1};
  cout << x2 - dv[1] << " " << y2 + dv[0] << " " 
       << x2 - dv[1] - dv[0] << " " << y2 + dv[0] - dv[1] << endl;  




  return 0; 
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  string s;
  cin>>s;
  ll d;
  cin>>d;
  vector<vecll> dp(2, vecll(d, 0));
  dp[1][0] = 1;
  constexpr ll MOD = 1000000007;
  for(char c:s) {
    int num = c - '0';
    vector<vecll> tmp(2, vecll(d, 0));
    for(auto&& i:irange(0,10)) {
      for(auto&& j:irange(0l,d)) {
        tmp[0][(j+i)%d] += dp[0][j];
        tmp[0][(j+i)%d] %= MOD;
        if (i < num) {
          tmp[0][(j+i)%d] += dp[1][j];
          tmp[0][(j+i)%d] %= MOD;
        }
        if (i == num) {
          tmp[1][(j+i)%d] += dp[1][j];
          tmp[1][(j+i)%d] %= MOD;
        }
      }
    }
    swap(tmp, dp);
  }
  cout<<(dp[0][0] + dp[1][0] + MOD - 1) % MOD<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<queue>
#include<deque>
#include<vector>
#include<algorithm>
using namespace std;

inline void reader(int *x) {
	int k = getchar_unlocked(); *x = k - '0';
	while (true) {
		k = getchar_unlocked();
		if (k < '0') break;
		*x = ((*x) << 1) + ((*x) << 3) + k - '0';
	}
}
inline void writeln(int x) {
	int s = 0, p; char f[7];
	while (x) {
		p = x; x /= 10;
		f[s++] = p - (x << 1) - (x << 3);
	}
	if (!s) f[s++] = 0;
	while (s--) putchar_unlocked(f[s] + '0');
	putchar_unlocked('\n');
}
#pragma warning(disable:4996)
int n, m, q, a[200003], b[200003], c[200003], d[200003], e[100003], f[100003], g[100003];
int h1[100003], h2[100003], h3[100003], h4[100003], dist[100003], E[200003];
vector<pair<int, int> > z[100003]; vector<int> x[100003];
vector<int>D[100003];
int Q1[110000], Q1L, Q1R;
int main() {
	reader(&n); reader(&m); reader(&q);
	fill(d, d + m + 1, 1 << 30);
	for (int i = 1; i <= m; i++) { reader(&a[i]), reader(&b[i]); f[a[i]]++; f[b[i]]++; }
	for (int i = 1; i <= q; i++) reader(&c[i]), d[c[i]] = i;
	for (int i = 1; i <= n; i++) { x[i].resize(f[i]); }
	for (int i = 1; i <= m; i++) {
		x[a[i]][g[a[i]]] = b[i]; g[a[i]]++;
		x[b[i]][g[b[i]]] = a[i]; g[b[i]]++;
	}
	fill(dist, dist + n + 1, -1); dist[1] = 0;
	Q1[0] = 1; Q1R = 1;
	int rn = 0;
	while (Q1R > Q1L) {
		int a1 = Q1[Q1L]; Q1L++;
		for (int i : x[a1]) {
			if (dist[i] == -1) {
				dist[i] = dist[a1] + 1;
				Q1[Q1R] = i; Q1R++; rn = dist[i];
			}
		}
	}
	for (int i = 1; i <= m; i++) {
		if (dist[a[i]] > dist[b[i]]) h1[a[i]]++;
		if (dist[b[i]] > dist[a[i]]) h1[b[i]]++;
	}
	for (int i = 1; i <= n; i++)z[i].resize(h1[i]);
	for (int i = 1; i <= m; i++) {
		if (dist[a[i]] > dist[b[i]]) { z[a[i]][h2[a[i]]] = make_pair(b[i], d[i]); h2[a[i]]++; }
		if (dist[b[i]] > dist[a[i]]) { z[b[i]][h2[b[i]]] = make_pair(a[i], d[i]); h2[b[i]]++; }
	}
	for (int i = 1; i <= n; i++) h3[dist[i]]++;
	for (int i = 0; i <= rn; i++) D[i].resize(h3[i]);
	for (int i = 1; i <= n; i++) D[dist[i]][h4[dist[i]]] = i, h4[dist[i]]++;
	e[1] = (1 << 30);
	for (int i = 1; i <= rn; i++) {
		for (int j : D[i]) {
			for (pair<int, int>k : z[j]) {
				e[j] = max(e[j], min(e[k.first], k.second));
			}
		}
	}
	for (int i = 2; i <= n; i++) {
		if (e[i] < 300000) E[e[i]]++;
	}
	for (int i = 1; i <= q; i++) {
		E[i] += E[i - 1];
		writeln(E[i]);
	}
	return 0;
}

Measured memory_bytes: 24988
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	d := make(map[int]map[int]int)
	for i := 1; i <= n; i++ {
		d[i] = make(map[int]int)
	}

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 1; i < n; i++ {
		scanner.Scan()
		u, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		v, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		dist, _ := strconv.Atoi(scanner.Text())
		d[u][v] = dist
		d[v][u] = dist

	}

	c := make([]int, n)

	searched := make(map[int]bool)
	var resolve func(pos int, color int)
	resolve = func(pos int, color int) {
		if searched[pos] {
			return
		}

		searched[pos] = true
		c[pos-1] = color
		for k, v := range d[pos] {
			if v%2 == 0 {
				resolve(k, color)
			} else {
				resolve(k, (color+1)%2)
			}
		}
	}
	resolve(1, 0)

	for i := 0; i < n; i++ {
		fmt.Println(c[i])
	}
}


Measured memory_bytes: 54912
#include <bits/stdc++.h>
#define deg ASDASDASDSAD
using namespace std;

string ans;
int len;

void question(int type, string s)
{
    if(type == 0)
    {
        cout << "? " << s << '\n';
        cout.flush();
    }else
    {
        cout << "! " << s << '\n';
        cout.flush();
        exit (0);
    }
}

string intToString(long long x)
{
    string ans;
    while(x)
    {
        ans.push_back(x % 10 + '0');
        x /= 10;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int strigToInt(string x)
{
    int ans = 0;
    for(int i = 0; i < x.size(); ++i)
        ans = ans * 10 + x[i] - '0';
    return ans;
}

bool get()
{
    char q;
    cin >> q;
    return q == 'Y';
}

void checkZero() /// TODO
{
    for(int i = 1, cur = 1; i <= 10; ++i)
    {
        question(0, intToString(cur * 2));
        if(get())
        {
            question(1, intToString(cur));
            break;
        }
        cur *= 10;
    }
}

string goodQ(string s, char q)
{
    s.push_back(q);
    while(s.size() <= len + 1)
        s.push_back('0');
    return s;
}

string deg(string s)
{
    int cur = s.size() - 1;
    while(cur >= 0 && s[cur] == '0')
    {
        s[cur] = '9';
        --cur;
    }
    --s[cur];
    if(s[0] == '0')
        s.erase(0, 1);
    return s;
}

char get(int pos)
{
    char l = '0';
    char r = '9';
    if(pos == 1)
        l = '1';
    char res = '#';
    while(l <= r)
    {
        char mid = (l + r) / 2;
        string q;
        if(mid == '1')
        {
            if(pos == 1)
                q = goodQ(ans, '1');
            else
                q = deg(goodQ(ans, mid));
        }else
            q = deg(goodQ(ans, mid));

        question(0, q);
        if(!get())
        {
            res = mid;
            l = mid + 1;
        }else
            r = mid - 1;
    }
    /**
    if(res == '#')
        return res;

    if(res != '9')
    {
        string s = goodQ(ans, res + 1);

        question(0, deg(s));

        if(!get())
        {
            question(0, deg(s));
            if(get())
                return '9';
        }
    }*/

    return res;
}



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

    len = 0;
    for(int i = 1, cur = 1; i <= 10; ++i)
    {
        question(0, intToString(cur));
        if(!get())
        {
            len = i - 1;
            break;
        }
        cur *= 10;
    }

    if(!len)
        checkZero();

    if(len == 1)
    {
        for(int i = 90; i >= 10; i -= 10)
        {
            question(0, intToString(i));
            if(!get())
                question(1, intToString(i / 10 + 1));
        }
        question(1, intToString(1));
    }

    for(int i = 1; i <= len; ++i)
    {
        char q = get(i);
        if(q == '#')
            break;
        else
            ans.push_back(q);
    }

    cout << "! ";
    cout << ans;
    for(int i = 0; i < len - ans.size(); ++i)
        cout << 0;
    cout << '\n';
    cout.flush();

    return 0;
}


Measured memory_bytes: 724
using System;
class Program
    {
        static void Main(string[] args)
        {
            //まずは数を代入する
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int p = int.Parse(input[1]);

            //リンゴのかけらの数を求める
            int sum = a * 3 + p;

            //できるパイの数を計算
            sum = sum / 2;

            //出力
            Console.WriteLine(sum);
        }
    }

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

int main(void){
    char c;
    cin >> c;
    cout << char(c+1);
    return 0;
}

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

int main(){
  int a, b, k;
  cin >> a >> b >> k;
  int cnt = 0;
  int mini = min(a, b);
  for(int i = mini; i > 0; --i){
    if(a % i == 0 && b % i == 0){
      cnt++;
    }
    if(cnt == k){
      cout << i << endl;
      break;
    }
  }
}
      

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=sorted(limii())


a=arr[-1]

def take_closest(myList, myNumber):
    """
    Assumes myList is sorted. Returns closest value to myNumber.

    If two numbers are equally close, return the smallest number.
    """
    pos = bisect_left(myList, myNumber)
    if pos == 0:
        return myList[0]
    if pos == len(myList):
        return myList[-1]
    before = myList[pos - 1]
    after = myList[pos]
    if after - myNumber < myNumber - before:
       return after
    else:
       return before

print(a,take_closest(arr,a/2))


Measured memory_bytes: 87660
from itertools import permutations

ways = [tuple(map(int, input().split())) for _ in range(3)]
for p in permutations(ways, 3):
    path1 = [p[0][0], p[0][1]]; path2 = [p[0][1], p[0][0]]
    for i in range(1, 3):
        if path1[-1] in p[i]:
            a, b = p[i]; path1.append(a if path1[-1] == b else b)
        if path2[-1] in p[i]:
            a, b = p[i]; path2.append(a if path2[-1] == b else b)
    if max(len(path1), len(path2)) == 4: print('YES'); break;
else: print('NO')

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <queue>

#include <unordered_map>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <sstream>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll pow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = pow(N, P/2);
        return t*t;
    }
    return N * pow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    n=abs(n);
    m=abs(m);
    if(n*m==0)return max(n,m);
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
int main() {
    ll a,b,n;cin>>a>>b>>n;
    if(b-1>n){
        cout<<a*n/b<<endl;
        return 0;
    }
    if(a%b==0){
        cout<<a-a/b<<endl;
    }
    else {
        cout<<a-a/b-1<<endl;
    }

}

Measured memory_bytes: 3596
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

ll n,a[N];
signed main(){
    FastIO;
    cin>>n;
    rep(i,1,n) cin>>a[i];
    sort(a+1,a+n+1,greater<ll>());
    ll sum=a[1],t=n-2;
    rep(i,2,n){
        int x=min(t,2ll);
        t-=x;
        sum+=x*a[i];
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 5164
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        String str = scan.next();
        int cnt = str.length();
        if (cnt<=num) {
			System.out.println(str);
		} else {
            String str2 = str.substring(0, num);
			System.out.println(str2+"...");
		}
        scan.close();
    }
}

Measured memory_bytes: 38676
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
char st[21];
int main()
{
	scanf("%s",st+1);
	int len=strlen(st+1);
	if(st[1]!='A') printf("WA\n");
	else
	{
		int c=0,t;
		for(int i=1;i<=len;i++) if(st[i]=='C') c++,t=i;
		if(t<3||t==len||c!=1){printf("WA\n");return 0;}
		for(int i=1;i<=len;i++)
		{
			if(i!=1&&i!=t)
			{
				if(st[i]>='A'&&st[i]<='Z'){printf("WA\n");return 0;}
			}
		}
		printf("AC\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int N,K;
    int[] A;

    private void solve() {
       N = nextInt();
       K = nextInt();
       A = new int[N];
       for(int i = 0;i < N;i++) {
           A[i] = nextInt();
       }

//       各整数ごとに個数をカウント
       int[] a = new int[200000 + 1];
       for(int i = 0;i < N;i++) {
           a[A[i]]++;
       }

//       各個数ごとにカウント
       int[] b = new int[N + 1];
       for(int i = 0;i < 200000 + 1;i++) {
           if (a[i] > 0){
               b[a[i]]++;
           }
       }

//       整数の種類数を求める
       int count = 0;
       for(int i = 0;i < 200000 + 1;i++) {
           if (a[i] > 0) {
               count++;
           }
       }

       int ans = 0;
       for(int i = 0;i < N + 1;i++) {
           int min = Math.min(count - K, b[i]);

           ans += min * i;
           count -= min;
       }

       out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

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

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

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

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

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

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

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

Measured memory_bytes: 45580
#include<iostream>
using namespace std;
int main(){
  int count[100];
  int b;
  int ans[100];
  int ans2[100];
  int ans3;
  ans3 = 0;
  for(int i=0;i<100;i++){
    ans[i] = 0;
    ans2[i] = 0;
    count[i] = 0;
  } 
  while(cin>>b) count[b-1]++;
  for(int i=0;i<100;i++){
    if(ans[ans3]<count[i]){
      ans[i] = count[i];
      ans2[i] = i + 1;
      ans3 = i;
      for(int k=0;k<100;k++) if(k!=i) ans2[k] = 0;    
    }
    else if(ans[ans3]==count[i]&&ans3!=0) ans2[i] = i + 1;
  }
  for(int i=0;i<100;i++) if(ans2[i]!=0) cout << ans2[i] << endl;
  return 0;
}

Measured memory_bytes: 1156
def gcm(a,b):
    while b != 0:
        a, b = b, a % b
    return a

def gcm_list(a):
    ans = a[0]
    l = len(a)
    for i in range(1, l):
        ans = gcm(ans, a[i])
    return ans

N = int(input())
A = list(map(int, input().split()))
print(gcm_list(A))


Measured memory_bytes: 62704
#include <iostream>

using namespace std;

int main(){

  char a,b,c,d,e,f,g,h,i;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> f;
  cin >> g;
  cin >> h;
  cin >> i;
  cout << a << e << i;

}


Measured memory_bytes: 256
def main():
    N = int(input())

    def enum_divisors(n):
        ans = 10**12
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                v1 = str(i)
                v2 = str(n//i)
                ans = min(ans, max(len(v1), len(v2)))
        return ans

    print(enum_divisors(N))


if __name__ == '__main__':
    main()


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

namespace C___Anti_Division
{
    class Program
    {
        static void Main(string[] args)
        {
            var A_B_C_D = Console.ReadLine().Split().Select(decimal.Parse).ToArray();
            decimal A = A_B_C_D[0], B = A_B_C_D[1], C = A_B_C_D[2], D = A_B_C_D[3];
            decimal E = Lcm(C, D);
            decimal res = 0;

            decimal cnt_C = Math.Floor(B / C) - Math.Ceiling(A / C) + 1;
            decimal cnt_D = Math.Floor(B / D) - Math.Ceiling(A / D) + 1;
            decimal cnt_E = Math.Floor(B / E) - Math.Ceiling(A / E) + 1;

            res = B - A + 1 - (cnt_C + cnt_D - cnt_E);
            Console.WriteLine(res);
        }

        static decimal Lcm(decimal a, decimal b)
        {
            return a * b / Gcd(a, b);
        }

        static decimal Gcd(decimal a, decimal b)
        {
            if (a == 0) return b;
            if (b == 0) return a;

            return a > b ? GcdRecursive(a, b) : GcdRecursive(b, a);
        }

        static decimal GcdRecursive(decimal l, decimal r) => r == 0 ? l : GcdRecursive(r, l % r);
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
const int mod=1e9+7;
ll f[10010][101],d,ans,cnt;
string k;
int main()
{
	cin>>k>>d;
	f[0][0]=1;
	for(int i=1;i<=k.size();i++)
	{
		for(int j=0;j<=9;j++)
		{
		//	if(i!=1 || j)
			{
			//	if(j || i!=k.size()) 
			//	{
					for(int l=0;l<d;l++)
					{
						if(l>=j)
							f[i][l]=(f[i][l]+f[i-1][l-j])%mod;
						else
						{
							f[i][l]=(f[i][l]+f[i-1][d+(l-j)%d])%mod;
							if(d+(l-j)%d==d)
								f[i][l]=(f[i][l]+f[i-1][0])%mod;
						}
							
					}
			//	}
			}
			
			
		}
//		for(int l=0;l<d;l++)
//			cout<<i<<' '<<l<<' '<<f[i][l]<<endl;
	}
	for(int i=0;i<k.size();i++)
	{
		
		for(int j=0;j<k[i]-'0';j++)
		{
		//	if(j<k[i]-'0')
			{
				ans=(ans+f[k.size()-i-1][d-(cnt+j)%d])%mod;
				if(d-(cnt+j)%d==d)
					ans=(ans+f[k.size()-i-1][0])%mod; 
		//		cout<<d-(cnt+j)%d<<endl;
			}
		}
		cnt+=k[i]-'0';
	}
	int cnt1=0;
	for(int i=0;i<k.size();i++)
		cnt1+=k[i]-'0';
	if(cnt1%d==0)
		ans++;
	cout<<(ans+mod-1)%mod<<endl;
	return 0;
}


Measured memory_bytes: 8192
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||exec({Z=>'50000000'},'ruby',$0)
def f(i,c)(h=(H[i].map{|e|f e,i}.max||0)+1)>=K&&c!=1&&(h=0;$r+=1);h end
N,K,*A=`dd`.split.map &:to_i
H=Hash.new{|h,k|h[k]=[]}
(2..N).each{|i|H[A[i-1]]<<i}
f($r=1,1)
p $r-(A[0]==1?1:0)

Measured memory_bytes: 225304
# -*- coding:utf-8 -*-
"""考え方
1回目のt行きは、右行ったあと上
1回目のs行きは、左行ったあと下
2回目のt行きは、一回下行って、右行ったあと上、その後左
2回目のs行きは、一回上行って、左行ったあと下、その後右
"""
def solve():
    sx, sy, tx, ty = list(map(int, input().split()))
    ans = ""
    
    # 一回目のt行き
    ans += "R"*(tx-sx)
    ans += "U"*(ty-sy)

    # 一回目のs行き
    ans += "L"*(tx-sx)
    ans += "D"*(ty-sy)

    # 二回目のt行き
    ans += "D"
    ans += "R"*(tx-sx+1)
    ans += "U"*(ty-sy+1)
    ans += "L"

    # 二回目のs行き
    ans += "U"
    ans += "L"*(tx-sx+1)
    ans += "D"*(ty-sy+1)
    ans += "R"

    print(ans)

if __name__ == "__main__":
    solve()


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

using namespace std;

const int MAX = 1000010;

int main(){
	int n;
	cin >> n;
//	vector<int> a(n);
	vector<int> c(MAX);
	int G = 0;
	for(int i = 0; i < n; i++){
		int x; cin >> x;
		++c[x];
		G = __gcd(G,x);
	}
	bool pairwise = true;
	bool setwise  = false;
	for(int g = 2; g < MAX; g++){
		int cnt = 0;
		for(int j = g; j < MAX; j+=g){
			cnt+=c[j];
		}
		if(cnt > 1){
			pairwise = false;
		}
	}
	if(pairwise){
		cout << "pairwise coprime" << "\n";
	}else if(G==1){
		cout << "setwise coprime" << "\n";
	}else{
		cout << "not coprime" << "\n";	
	}
	return 0;
}


Measured memory_bytes: 7216
#include <iostream>

using namespace std;

int main(){
 int n=0;
 int count=0;
 while(true){
  cin>>n;
  if(n==0){
   break;
  }else{
   for(int i=1;i<n;i++){
    for(int j=i+1;j<n;j++){
     if((j-i+1)*(i+j)/2==n){
      count++;
     }
    }
   }
  }
  cout<<count<<endl;
  count=0;
 }
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
long comb(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
using namespace std;

int main(){
   int a,b,c;
   std::cin >> a>>b>>c;
   if((a==b)&&(b!=c))std::cout << "Yes" << std::endl;
   else if((a==c)&&(b!=c))std::cout << "Yes" << std::endl;
   else if((c==b)&&(a!=c))std::cout << "Yes" << std::endl;
   else std::cout << "No" << std::endl;
   
}





Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=998244353;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

#define MAX_N 1000010
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){// this size is really ok??
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r);
}

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

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

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

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

  int A,B,C,D;
  cin>>A>>B>>C>>D;

  vector<vector<ll>> dp(C+1,vector<ll> (D+1,0));
  dp[A][B]=1;
  for(int i=A;i<=C;i++) for(int j=B;j<=D;j++){
    if(dp[i][j]==0) continue;
    if(i+1<=C) add(dp[i+1][j],dp[i][j]*j%MOD);
    if(j+1<=D) add(dp[i][j+1],dp[i][j]*i%MOD);
    if(i+1<=C&&j+1<=D){
      ll res=i*j*dp[i][j]%MOD;
      add(dp[i+1][j+1],MOD-res);
    }
  }

  cout<<dp[C][D]<<endl;


  return 0;
}


Measured memory_bytes: 73620
#include<stdio.h>

int main(void)
{
    int n,i,w=0;
    scanf("%d",&n);
    int a[n];


   for(i=0;i<n;i++)
    scanf("%d",&a[i]);
   for(i=0;i<n;i++)
   {
       if(a[i]!=i+1)
       {
           w++;
       }


   }
    if(w>=0&&w<=2)
       {
           printf("YES");
       }
       else
       {
           printf("NO");
       }



    return 0;
}


Measured memory_bytes: 128
#! /usr/bin/python3
# たてなが / Thin

"""
縦 H ピクセル、横 W ピクセルの画像があります。
全てのピクセルは . または * で表されるものとします。
上から i 番目、左から j 番目のピクセルを表す文字を Ci,j で表します。

この画像を 2 倍縦長にした画像を出力してください。
すなわち、縦 2H ピクセル、横 W ピクセルの画像であって、
上から i 番目、左から j 番目のピクセルは、
C(i+1)⁄2,j (ただし、割り算は切り捨て)と等しい画像を出力してください。
"""

test_mode = False

H, W = map(int, input().split())
img = [0]
img_2x = ['0' for _ in range(H*2 +1)]  # Wx2Hの2次元リスト

for _ in range(H):
    img.append(input())
    if test_mode:
        print(img)

for i in range(1, H*2 +1):
    if test_mode:
        print('i =', i)
    k = (i+1)//2
    img_2x[i] = img[k]
    print(img_2x[i])


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  double ans = 0;
  for (int i = 0; i < n; ++i) {
    double p;
    cin >> p;
    ans += 1 / p;
  }
  cout << 1 / ans << endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}


fn main() {
    let n = read::<usize>();
    let bx = read_vec::<usize>();


    let mut ax = vec![];

    for i in 0..n {
        let mut a = if i < n - 1 {
            bx[i]
        } else {
            1_000_000
        };
        if i != 0 {
            a = std::cmp::min(a, bx[i-1]);
        }
        ax.push(a);
    }
    let ans = ax.iter().sum::<usize>();

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

Measured memory_bytes: 4352
import copy
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
b = copy.deepcopy(a)
amax = max(a)
b.remove(amax)
amax2 = max(b)
for i in range(n):
    if a[i] == amax:
        print(amax2)
    else:
        print(amax)


Measured memory_bytes: 14560
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }
int main()
{
    int L, R, d;
    cin >> L >> R >> d;
    int count = 0;
    for (int i=L; i<=R; i++) {
        if (i % d == 0) {
            count += 1;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in t1,t2,a1,a2,b1,b2;
    cin>>t1>>t2>>a1>>a2>>b1>>b2;
    if(a1>b1){
        swap(a1,b1);
        swap(a2,b2);
    }
    if(a2<b2){
        cout<<0<<endl;
        return 0;
    }
    in xa=t1*a1+t2*a2;
    in xb=t1*b1+t2*b2;
    if(xa<xb){
        cout<<0<<endl;
        return 0;
    }
    if(xa==xb){
        cout<<"infinity"<<endl;
        return 0;
    }
    in d1=t1*(b1-a1);
    in d2=xa-xb;
    if(d1%d2==0){
        cout<<(d1/d2)*2<<endl;
    }
    else{
        cout<<(d1/d2)*2+1<<endl;
    }
}/*
./problem.exe
*/

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Map<String,Integer> map=new HashMap<>(50);
  map.put("MON",1);
  map.put("TUE",2);
  map.put("WED",3);
  map.put("THU",4);
  map.put("FRI",5);
  map.put("SAT",6);
  map.put("SUN",7);
  Scanner s=new Scanner(System.in);
  String in=s.next();
  String sun="SUN";
  if(in.equals(sun))
    System.out.println(7);
  else
    System.out.println(7-map.get(in));
}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;
  }else if(N == 2){
    int A, B;
    cin >> A >> B;
    cout << A+B << endl;
  }
}

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

int main() {
  string s;
  cin >> s;
  string res="";
  int j=0;
  for(int i=0;i<s.size();i++){
    int com = s.at(i)-'0';
    if(com == 0 || com == 1){
      res += s.at(i);
      j++;
    }else if(j != 0){
      string tmp="";
      for(int k=0;k<j-1;k++){
        tmp += res.at(k);
      }
      res = tmp;
      j--;
    }
  }
  cout << res << endl;
  return 0;
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
  	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
  	printf("%d %d %d",c,a,b);
  	return 0;
}


Measured memory_bytes: 256
def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))

    for i in range(51):
        a = x - i
        b = x + i
        if a not in p and a >= 0:
            print(a)
            return
        if b not in p and b <= 101:
            print(b)
            return
    
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 9184
/*
QUESTION    :

RULE        :

INPUT       :

OUTPUT      :
*/
/*
    int     :10^9
long long   :10^19
*/
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<(n);++i)
#define repeq(i,a,n) for(int i=a;i<=(n);++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const long double PI =(acos(-1));

int main(){
    int N;
    int cnt=0;
    cin >> N;
    vector<int> a(N+1);
    rep(i,1,N+1){
        cin >> a.at(i);
    }
    rep(i,1,N+1){
        if(a.at(i)%2==1 && i%2==1){
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

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

int main() {
    int count;
    count=0;
    string s;
    cin>>s;
    for (int i=0;i<3;i++) {
        if (s.at(i)-48==1) {
            count++;
        }
    }
    cout<<count<<endl;
}


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

int main() {
	int a;
	a = 1;
	int b, c;
	cin >> b >> c;
	for (int i = 0; i < b; i++) {
		if (a < c) {
			a *= 2;
		}
		else {
			a = a + c;
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
// Aizu Vol-6 0620: Swapping Bibs
// 2017.9.5 bal4u@uu

#include <stdio.h>

int a[102];

int main()
{
	int n, m, i, k, t;

	scanf("%d%d", &n, &m);
	for (i = 1; i <= n; i++) scanf("%d", a+i);
	for (k = 1; k <= m; k++) {
		for (i = 1; i < n; i++)
			if (a[i] % k > a[i+1] % k) t = a[i], a[i] = a[i+1], a[i+1] = t;
	}
	for (i = 1; i <= n; i++) printf("%d\n", a[i]);
	return 0;
}

Measured memory_bytes: 1808
def main():
    H, W = (int(i) for i in input().split())
    c = [input() for i in range(H)]
    from collections import deque

    def bfs(sy, sx):
        que = deque()
        dist = [[-1]*W for i in range(H)]
        dist[sy][sx] = 0
        que.append((sy, sx))
        d = ((1, 0), (0, 1), (-1, 0), (0, -1))
        while que:
            uh, uw = que.popleft()
            for dy, dx in d:
                next_h = uh + dy
                next_w = uw + dx
                if not(0 <= next_h < H and 0 <= next_w < W):
                    continue
                if dist[next_h][next_w] != -1:
                    continue
                if c[next_h][next_w] == '#':
                    continue
                dist[next_h][next_w] = dist[uh][uw] + 1
                que.append((next_h, next_w))
        return dist
    d = bfs(0, 0)
    if d[-1][-1] == -1:
        return print(-1)
    seen = [True]*(d[H-1][W-1] + 1)
    ans = 0
    for h in range(H):
        for w in range(W):
            if c[h][w] == "#":
                continue
            elif d[h][w] != -1 and d[h][w] <= d[-1][-1] and seen[d[h][w]]:
                seen[d[h][w]] = False
                continue
            else:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
  int n;

  int count = 0;

  cin >> n;

  vector<int> a(n);

  rep(i,n){
    cin >> a.at(i);
  }

  for (int i = 1; i <= n; i++)
  {
    if (i % 2 == 1 && a.at(i-1) % 2 == 1)
    {
     count++;
     }
  }

  cout << count;
}


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

int main() {
  int N;
  scanf("%d", &N);
  int a[N],b[N];
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d", &b[i]);
  }

  int sum;
  int maxsum = 0;

  for(int j = 0; j < N; ++j){
    sum = 0;
    for(int k = 0; k < j+1; ++k) sum += a[k];
    for(int k = j; k < N; ++k) sum += b[k];
    if(sum>maxsum) maxsum=sum;
    
  }

  cout << maxsum << endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

int main(){
    ll a;
    double b;
    cin >> a >> b;
    ll bd = round(b*100.00);
    
    ll ans = a*bd;
    
    cout << ans/100 << endl;
    return 0;
}

Measured memory_bytes: 3776
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int[] a = new int [3];
	for(int i = 0; i < a.length; i++){
	a[i] = sc.nextInt();
	}
for(int i = 0; i < a.length; i++) {
	for(int j = i + 1; j < a.length; j++) {
		if(a [i] > a [j]) {
			int temp;
			temp = a[i];
			a[i] = a[j];
			a[j] = temp;
		}
	}
}
for (int i = 0; i < 3; i++)
{
    if (i == 0)
        System.out.print(a[i]);
    else if(i==1)
        System.out.printf(" %d", a[i]);
    else if(i==2)
        System.out.println(" "+a[i]);
}
}
}


Measured memory_bytes: 26344
def accumulater2D(A): # B:list[list[int]]
    import copy
    #ヨコに累積和
    n = len(A)
    B = copy.deepcopy(A)
    for i in range(n):
        for j in range(n):
            if i: B[i][j] += B[i-1][j]
    #タテに累積和
    for i in range(n):
        for j in range(n):
            if j: B[i][j] += B[i][j-1]
    return B # Aの2次元累積和

N,M,Q = map(int,input().split())
LR = []
pq = []
tiles = [[0 for x in range(N+1)] for y in range(N+1)]
for i in range(M):
    L,R = list(map(int,input().split()))
    tiles[L][R] += 1
    #LR.append([L-1,R-1])
A = accumulater2D(tiles)
for i in range(Q):
    p,q = list(map(int,input().split()))
    pq.append([p,q])

for i in range(Q):
    p,q = pq[i]
    print(A[q][q]-A[p-1][q]-A[q][p-1]+A[p-1][p-1])
    #pq.append([p-1,q-1])




Measured memory_bytes: 79832
using System;

class Program
{
	static void Main(string[] args)
	{
		string[] con = Console.ReadLine().Split(' ');
		int A = int.Parse(con[0]);
		int B = int.Parse(con[1]);
		int tap = A;
		int kosu = 1;
		
		while (B > tap) {
			kosu++;
			tap = tap + A - 1;
		}
		if (B == 1)
			kosu = 0;
		Console.WriteLine(kosu);
		Console.ReadLine();
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
 
// ------- library ------- //



// ----- library end ----- //



int main() {

  int N;
  cin >> N;

  
  //1-indexed
  vector<vector<vector<vector<ll> > > > DP(N+1, vector<vector<vector<ll> >>(4, vector<vector<ll> >(4, vector<ll>(4, 1)))); //


  //1文字目...は意味ないので無視する
  
  //2文字目...どれも条件を満たしていて、1通り
  //...ってことはやっぱ初期化する必要ない

  //3文字目...1のままだけど、駄目なやつが出てくる
  //AGC, GAC, ACGは駄目
  DP.at(3).at(1).at(2).at(0) = 0;
  DP.at(3).at(1).at(0).at(2) = 0;
  DP.at(3).at(2).at(1).at(0) = 0;

  REP(i, 4, N+1){ //4～Nまで
    // iは1-indexed !!
    rep(j, 4){
      rep(k, 4){
        rep(l, 4){
          DP.at(i).at(j).at(k).at(l) = (DP.at(i-1).at(k).at(l).at(0) + DP.at(i-1).at(k).at(l).at(1) + DP.at(i-1).at(k).at(l).at(2) + DP.at(i-1).at(k).at(l).at(3)) % MOD;
        }
      }
    }
    //j=C, Gの場合はNGパターンを引かないといけない
    //Gの場合 ACGだけバツ
    DP.at(i).at(2).at(1).at(0) = 0;
    //Cの場合
    //AGC, GACはバツ
    DP.at(i).at(1).at(2).at(0) = 0;
    DP.at(i).at(1).at(0).at(2) = 0;
    //AGAC, AGTCもバツ ただしAGACはもう0になっている
    DP.at(i).at(1).at(3).at(2) -= DP.at(i-1).at(3).at(2).at(0);
    //**GCの場合はAC, AG, ATがバツ
    DP.at(i).at(1).at(2).at(1) -= DP.at(i-1).at(2).at(1).at(0);
    DP.at(i).at(1).at(2).at(2) -= DP.at(i-1).at(2).at(2).at(0);
    DP.at(i).at(1).at(2).at(3) -= DP.at(i-1).at(2).at(3).at(0);
  }

  ll ans = 0;
  rep(j, 4){
    rep(k, 4){
      rep(l, 4){
        ans = (ans + DP.at(N).at(j).at(k).at(l)) % MOD;
      }
    }
  }
  cout << ans << endl;


// -- main() end -- //
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, s, i, j, k, x;
	cin >> n;
	vector<int> a(n);
	s = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
	}
	sort(a.begin(), a.end());
	if (s - a[n - 1] > a[n - 1]) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
package main

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

type MyScanner struct {
	sc *bufio.Scanner
}

type MyWriter struct {
	stdout io.Writer
}

type MyPut interface{}

func getScanner(fp io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 500001), 500000)
	return sc
}

func getHugeScanner(fp io.Reader, size int) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, size), size)
	return sc
}

func (mysc *MyScanner)String() string {
	mysc.sc.Scan()
	return mysc.sc.Text()
}

func (mysc *MyScanner)Int() int {
	i, _ := strconv.Atoi(mysc.String())
	return i
}

func (mysc *MyScanner)Int64() int64 {
	i, _ := strconv.ParseInt(mysc.String(), 10, 64)
	return i
}

func (mysc *MyScanner)Float64() float64 {
	i, _ := strconv.ParseFloat(mysc.String(), 64)
	return i
}

func (mw MyWriter)Puts(v MyPut) {
	_, _ = fmt.Fprintf(mw.stdout, "%v\n", v)
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := MyScanner{getScanner(stdin)}
	mw := MyWriter{stdout}

	n := sc.Int()

	b := 0
	ans := 0
	tmp := 0
	for i := 0; i < n; i++ {
		input := sc.Int()
		if input <= b {
			tmp++
		} else {
			if tmp > ans {
				ans = tmp
			}
			tmp = 0
		}
		b = input
	}
	if tmp > ans {
		ans = tmp
	}
	mw.Puts(ans)
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N, T; cin >> N >> T;
  vector<int> t(N);
  rep(i, N) cin >> t[i];
  
  int ans = 0;
  
  rep(i, N-1) {
    if(t[i+1]-t[i] <= T) ans += t[i+1]-t[i];
    else ans += T;
  }
  
  cout << ans+T << endl;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int gcd(int A,int B) {if(!B)return A;return gcd(B,A%B);}

int main()
{
	ll n,k,c;
	cin>>n>>k>>c;
	string s;
	cin>>s;
	vector<int>a,l;
	for(int i=0;i<n;i++)if(s[i] == 'o'){a.pb(i+1);i+=c;} //earliest xth workday
	for(int i=n-1;i>=0;i--)if(s[i] == 'o'){l.pb(i+1);i-=c;} //latest xth workday
	vector<int>ans;
	for(int i=0;i<k;i++){
		if(a[i] == l[k-i-1])cout<<a[i]<<endl;
	}
}

Measured memory_bytes: 3448
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<utility>
#include<string>
#include<iomanip>
#include<queue>
#include<cmath>
#include<utility>
#include<set>
#include<cmath>
#define MOD 998244353
using namespace std;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    string a, b;
    cin >> n >> a >> b;
    for(int i = 0; i < n; i++)
        cout << a[i] << b[i];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int gcd(int a, int b){
	return (b > 0)? gcd(b, a % b) : a ;
}
int main(){
	int N; cin >> N; 
	int A[100010] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	int G1 = A[0]; int G2 = A[N/2]; 
	for(int i = 0; i < N/2; i++){
		G1 = gcd(G1, A[i]); 
	}
	for(int i = N/2; i < N; i++){
		G2 = gcd(G2, A[i]); 
	}
	vector<int> D1 = {}; 
	for(int i = 1; i*i <= G1; i++){
		if(G1 % i == 0) {D1.push_back(i); 
			D1.push_back(G1/i); 
		}	
	}
	sort(D1.begin(), D1.end(), greater<int>()); 
	int C1 = 0; 
	for(int i = 0; i < D1.size(); i++){
		int count = 0; 
		for(int j = N/2; j < N; j++){
			if(A[j] % D1[i] != 0) count++; 
		}
		if(count <= 1) {C1 = D1[i]; break;}
	}
	vector<int> D2 = {}; 
	for(int i = 1; i*i <= G2; i++){
		if(G2 % i == 0) {D2.push_back(i); 
			D2.push_back(G2/i); 
		}	
	}
	sort(D2.begin(), D2.end(), greater<int>()); 
	int C2 = 0; 
	for(int i = 0; i < D2.size(); i++){
		int count = 0; 
		for(int j = 0; j < N/2; j++){
			if(A[j] % D2[i] != 0) count++; 
		}
		if(count <= 1) {C2 = D2[i]; break;}
	}
	cout << max(C1, C2) << endl; 
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int a;
	int odds;
	int compound = 1;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (a & 1) {
			odds = 1;
		} else {
			odds = 2;
		}

		compound *= odds;
	}

	cout << pow(3, n) - compound << "\n";

	return 0;

}

Measured memory_bytes: 256