akhauriyash/Code-Regression huggingface dataset:
package main

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

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

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n:=getNextInt(scanner)
	ss:=make([]string, n)
	tt:=make([]int, n)
	stt:=make([]int, n+1)
	for i := 0; i < n; i++ {
		ss[i] = getNextString(scanner)
		tt[i] = getNextInt(scanner)
	}

	for i := 0; i < n; i++ {
		stt[i+1] = stt[i] + tt[i]
	}
	x:=getNextString(scanner)
	for i := 0; i < n; i++ {
		if ss[i] == x{
			fmt.Fprintln(writer, stt[n]-stt[i+1])
			return
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

string s;
ll k;
int main() {
    cin>>s>>k;

    if(k==1){
        ll cnt=1, ans=0;
        REP(i, 1, s.size()){
            if(s[i-1] == s[i]){
                cnt++;
                if(cnt%2==0){
                    ans++;
                }
            }
            else{
                cnt=1;
            }
        }

        cout<<ans<<endl;
    }
    else{
        string str=s+s;
        ll cnt=1, left=0, right=0;

        REP(i, 1, str.size()){
            if(str[i-1] == str[i]){
                cnt++;
                if(cnt%2==0){
                    if(i<str.size()/2){
                        left++;
                    }
                    else{
                        right++;
                    }
                }
            }
            else{
                cnt=1;
            }
        }

        if(cnt == str.size()){
            if(k%2==0){
                cout<<(left+right)*(k/2)<<endl;
            }
            else{
                cout<<(left+right)*(k/2)+left<<endl;
            }
        }
        else{
            cout<<left+right*(k-1)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
def inpl(): return list(map(int, input().split()))
N = int(input())
sa, sb, sc = 0, 0, 0
for i in range(N):
    a, b, c = inpl()
    sa, sb, sc = max(sb+a, sc+a), max(sa+b, sc+b), max(sa+c, sb+c)
print(max(sa, sb, sc))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define lint long long int
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define fill(a,x) fill(a.begin(),a.end(),x)
#define eb(data) emplace_back(data)
#define pb(data) emplace_back(data)
#define mp make_pair
#define ALNUM 26
#define vint vector<int>
#define vlint vector<lint>
#define F first
#define S second
#define ALL(data) data.begin(),data.end()
#define GEts(s) getline(cin,s);
#define UNIQUE(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())

using namespace std;
template<typename Rast>inline void out(Rast rast){cout<<rast<<"\n";return;}
template<typename Rast>inline void in(Rast& rast){cin>>rast;return;}
template<typename T>istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename First, typename... Rest>void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
template<typename First, typename... Rest>void out(First first, Rest... rest){cout << first<<" ";out(rest...);return;}
template<typename T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<typename T1,typename T2>bool chmax(T1& a,T2 b){if(a<b){a=b;return true;}else{return false;}}
template<typename T1,typename T2>bool chmin(T1& a,T2 b){if(a>b){a=b;return true;}else{return false;}}
template<typename T>T lcm(T a, T b){return a * b / gcd(a, b);}
static const double pi = 3.141592653589793;
int modpow(int a,int n,int p){if (n==0)return 1%p; if(n==1)return a%p;if(n%2==1)return (a*modpow(a,n-1,p))%p;lint t=modpow(a,n/2,p);return (t*t)%p;}//a^n%p
lint MOD=pow(10,9)+7;
//lint MOD=998244353;
lint inf=pow(2,50);
int intinf=pow(2,30);
/**int dirx[]={1,0};int diry[]={0,1};//*///右、下
/**int dirx[]={0,1,0,-1};int diry[]={-1,0,1,0};//*///四方位
/**int dirx[]={-1,0,1,1,1,0,-1,-1};int diry[]={-1,-1,-1,0,1,1,1,0};//*///八方位


class unionfind{
public:
	vector<int> table;
	void init(int size){
		table.resize(size);
		rep(i,size)table[i]=i;
	};
	int root(int index){
		if(table[index]==index)return index;
		else{
			int hoge=root(table[index]);
			table[index]=hoge;
			return hoge;
		}
	};
	bool same(int x,int y){
		return(root(x)==root(y));
	};
	int marge(int x,int y){
		int yroot=root(y);
		int xroot=root(x);
		if(xroot==yroot)return 0;
		table[yroot]=xroot;
		return 0;
	}
};

int main(){
	cin.tie(0);ios::sync_with_stdio(false);cout<<std::fixed<<std::setprecision(19);
	int ans=0;
	int n;
	in(n);
	vlint l(n);
	in(l);
	set<pair<lint,pair<lint,lint>>> anss;
	n=l.size();

	rep(i,n)arep(j,i+1,n)arep(k,j+1,n){
		vlint tab(3);
		tab[0]=l[i];
		tab[1]=l[j];
		tab[2]=l[k];
		sort(tab);

		if(tab[0]+tab[1]>tab[2]){
			if(tab[0]==tab[1]||tab[1]==tab[2]||tab[0]==tab[2])continue;
			ans++;
		}
	}
	out(ans);
	return 0;
}


Measured memory_bytes: 3660
N,Y=map(int,input().split())
# x+y+z=N
# 10000x+5000y+1000z=Y
# となるような正整数(x,y,z)はあるか？
ans=[-1,-1,-1]
for x in range(N+1):
  for y in range(N-x+1):
    z=N-x-y
    if 10000*x+5000*y+1000*z==Y:
      ans=[x,y,z]
print(ans[0],ans[1],ans[2])

Measured memory_bytes: 40812
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N, A, B = map(int, input().split())
    S = input()[:-1]
    
    a = 0
    b = 0
    for i in range(N):
        if S[i] == "a":
            if a + b < A + B:
                print("Yes")
                a += 1
            else:
                print("No")
        elif S[i] == "b":
            if a + b < A + B and b < B:
                print("Yes")
                b += 1
            else:
                print("No")
        else:
            print("No")


if __name__ == '__main__':
    main()

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

long long n;

long long solve();

int main() {
  cin >> n;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  ans = n * (n - 1) / 2;
  return ans;
}


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

int main()
{
	int a,b;
	cin >> a >>  b;

	int ans[3];

	ans[0] = a + b;
	ans[1] = a - b;
	ans[2] = a * b;

	sort(ans,ans+3);

	//for (auto i : ans)cout << i << endl;

	cout << ans[2] << endl;



	//cin>> a;
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
dic = Hash.new(0)
for i in 0..(n-1)
  order = gets.split(" ")
  if order[0] == "insert"
    dic[order[1]] = 1
  else
    if dic[order[1]] == 1
      puts "yes"
    else
      puts "no"
    end
  end
end

Measured memory_bytes: 48772
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}



vector<pll>adj[Max];

int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,b,c,d,cnt=0,q,l,r;

      bool flag=false;

      string str;






  cin>>n>>m;

  vector<pll>v;

 pair<string,string> Ans[m+2];


  for(i=0; i<m; i++)
  {
   cin>>a>>b;

   v.eb(a,b);

   adj[a].eb(b,i);

   d=log10(a)+1;


           string temp=to_string(a);

           for(ll j=0; j<6-d; j++)
                        temp="0"+temp;


           Ans[i].F=temp;
  }

   for(i=1; i<=n; i++)
   {
       sort(vll(adj[i]));

       cnt=1;

       for(auto x : adj[i])
       {

           d=log10(cnt)+1;

           string temp=to_string(cnt);;

           for(j=0; j<6-d; j++)
                        temp="0"+temp;


           Ans[x.S].S=temp;




           cnt++;
       }
   }

   for(i=0; i<m; i++)
   {
       cout<<Ans[i].F<<""<<Ans[i].S<<endl;
   }






}



Measured memory_bytes: 61552
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
N,Q = map(int,readline().split())
BIT = [0]*(N+1)

def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

def BIT_update(idx,x):
    while idx <= N:
        BIT[idx] += x
        idx += idx&(-idx)
    return

c = [-1]+list(map(int,readline().split()))
lastAppeared = [-1]*(N+1)
ans = [0]*Q
queries = []
lr = list(map(int,read().split()))
for q in range(Q):
    queries.append(lr[2*q+1]*10**12+lr[2*q]*10**6+q)
queries.sort()

curR = 0
for i in range(Q):
    query = queries[i]
    r = query//10**12
    query %= 10**12
    l = query//10**6
    q = query % 10**6
    while curR < r:
        curR += 1
        new = c[curR]
        last = lastAppeared[new]
        if last != -1:
            BIT_update(last,-1)
        lastAppeared[new] = curR
        BIT_update(curR,1)
    ans[q] = BIT_query(r)-BIT_query(l-1)
for i in range(Q):
    print(ans[i])

Measured memory_bytes: 218552
import heapq
N,M = map(int,input().split())
KL = [list(map(int,input().split())) for _ in [0]*N]

E = [{} for _ in [0]*(N+M)]
for i,kl in enumerate(KL):
    for l in kl[1:]:
        E[i][N+l-1] = 1
        E[N+l-1][i] = 1

def Dijkstra(N,E,start):
    d = [-1]*N
    q = [(0,start)]
    while q:
        ci,i = heapq.heappop(q)
        if d[i]!= -1:continue
        d[i] = ci
        for j,cj in E[i].items():
            if d[j]!=-1:continue
            heapq.heappush(q,(ci+cj,j))
    return d

d = Dijkstra(N+M,E,0)
ans = d[:N].count(-1)==0
print("YES" if ans else "NO")

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

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

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

    private static void solve() {
        int n = in.nextInt();

        out.println((n - 1) / 2);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 22484
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

int main () {
    int n = 0, k = 0;
    cin >> n >> k;
    vector<int> p(n);
    for (int i=0; i<n; i++) {
        cin >> p.at(i);
    }
    set<int> se;
    for (int i=0; i<k; i++) {
        se.insert(p.at(i));
    }
    int cnt = 1;
    for (int i=0; i<n-k; i++) {
        auto iter1 = se.begin();
        auto iter2 = se.end();
        iter2--;
        if (p.at(i) != *iter1 || p.at(i+k) < *iter2) {
            cnt++;
        }
        se.erase(p.at(i));
        se.insert(p.at(i+k));
    }
    int cnt_sorted = 0, cur = 1;
    for (int i=1; i<n; i++) {
        if (p.at(i) > p.at(i-1)) {
            cur++;
        }
        else {
            cur = 1;
        }
        if (cur == k) {
            cnt_sorted++;
        }
    }
    cout << (cnt_sorted == 0 ? cnt : cnt - cnt_sorted + 1) << endl;
    return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <map>
#include<queue>

const int INF = 1 << 28;
const long long MOD = 1000000007;
using namespace std;
using Graph = vector<vector<int>>;

template<class T> bool chmin(T &a, T &b) { if (a > b) { a = b; return 1; }return 0; }
template<class T> bool chmax(T &a, T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T, class U> using P = pair<T, U>;

vector<int> seen(50,-1);
int counter_for_dfs = 0;
void dfs(Graph &G, int v) {
	seen[v] = counter_for_dfs;
	counter_for_dfs++;
	for (auto v_next : G[v]) {
		if (seen[v_next]>=0)continue;

		dfs(G, v_next);
	}
}

void bfs(Graph &G) {
	vector<int> dist(G.size(), -1);
	queue<int> que;
	
	dist[0] = 0;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
		}
	}
	for (auto i : dist) {
		cout << i << " ";
	}
}

int counter[200005] = {};
void bfs2(Graph &G,int p,int x) {
	vector<int> dist(G.size() , -1);
	queue<int> que;
	
	dist[p] = 0;
	que.push(p);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
			counter[g] += x;
		}
	}
}
int main()
{
	int n, m, k;
	std::cin >> n >> m >> k;
	std::string ret = "No";

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			int a = (m - j) * i + (n - i) * j;
			if (a == k) {
				ret = "Yes";
				break;
			}
		}
	}
	std::cout << ret;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long k;
	cin>>k;
	long long a,b,c;
	a=k/50+50;
	b=k%50;
	c=a-b-1;
	   cout<<50<<endl;
    for(int i=0;i<50;i++)
    {
        if(i<b)
        {
            if(i==0)
            cout<<a;
            else
            cout<<" "<<a;
        }
        else
        {
            if(i==0)
            cout<<c;
            else 
            cout<<" "<<c;
        }
    }
    cout<<endl;
    return 0;
}

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

int main(){
	int X, N;
	cin >> X >> N;
	int tmp;
	map<int, int> p;
	for(int i=0;i<N;i++){
		cin >> tmp;
		p[tmp] = tmp;
	}

	int ans;
	for(int i=0;;i++){
		if(!p.count(X-i)){
			ans = X-i;
			break;
		}
		if(!p.count(X+i)){
			ans = X+i;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int dp[2][101];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<2;i++){
		for(int j=0;j<n;j++){
			cin>>dp[i][j];
		}
	}
	for(int i=1;i<n;i++){
		dp[0][i]+=dp[0][i-1];
	}
	dp[1][0]+=dp[0][0];
	for(int i=1;i<n;i++){
		dp[1][i]+=max(dp[1][i-1],dp[0][i]);
	}
	cout<<dp[1][n-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<i64>();
    let primes = get_primes(300000);
    for num in primes {
        if num >= n {
            println!("{}", num);
            return;
        }
    }
}

fn get_primes(n: i64) -> Vec<i64> {
    let mut is_prime = vec![true; n as usize + 1];
    let mut primes = Vec::new();
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n + 1 {
        if is_prime[i as usize] {
            primes.push(i);
            let mut j = 2 * i;
            while j < n {
                is_prime[j as usize] = false;
                j += i;
            }
        }
    }
    primes
}

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(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
# E - This Message Will Self-Distruct in 5s

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
assert len(a) == n

# Ai + Aj == j - i
# Aj - j == -Ai - i

# Aj - j の各値の個数
diff = Counter(a[j] - (j+1) for j in range(n))

# 各Aiについて Aj - j == -Ai - i となるjの個数を数える
count = 0
for i in range(n):
    diff[a[i] - (i+1)] -= 1  # i自身を取り除く
    count += diff[-a[i] - (i+1)]

print(count)


Measured memory_bytes: 40672
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=55;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll dp[N][N*N];
int main()
{
    std::ios::sync_with_stdio(false);
    int n,a;
    cin>>n>>a;
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        for(int j=i-1;j>=0;j--)
        for(int w=0;w<=N*j;w++)
        {
            dp[j+1][w+x]+=dp[j][w];
         //   cout<<j+1<<" "<<w+x<<" "<<dp[j+1][w+x]<<endl;
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=dp[i][i*a];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
from functools import reduce
from math import gcd

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

c=max(A)+1
D=[0]*c
div=[0]*c
P=[]

for i in range(2,c):
    if D[i]==0:
        P.append(i)
        D[i]=i
    for j in P:
        if i*j>=c  or j>D[i] :
           break
        D[i*j]=j
f=0
for i in A:
    if i==1:
        continue
    temp=i
    while temp!=1:
        if div[D[temp]]==1:
            f=1
            break
        div[D[temp]]+=1
        temp2=D[temp]
        while temp%temp2==0 and temp>=temp2:
            temp=temp//temp2
    if f==1:
        break
        


if max(div)<=1 and f==0:
    print('pairwise coprime')

elif reduce(gcd, A) == 1:
    print('setwise coprime')

else:
    print('not coprime')

Measured memory_bytes: 127784
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second

int dp[200000];


signed main(){
	memset(dp,0,sizeof(dp));
	vector<int>v;
	v.push_back(100);
	v.push_back(101);
	v.push_back(102);
	v.push_back(103);
	v.push_back(104);
	v.push_back(105);
	r(i,v.size())dp[v[i]]=1;

	r(i,140000){
		if(dp[i]){
			r(j,v.size()){
				dp[i+v[j]]=1;
			}
		}
	}

	int n;
	cin>>n;

	cout<<dp[n]<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef pair<int, int> P;

int main(){
    long h, w; int n; cin >> h >> w >> n;
    map<P, int> mp;
    int dx[3] = {-1, 0, 1};
    int dy[3] = {-1, 0, 1};
    rep(i, n){
        int a, b; cin >> a >> b;
        rep(j, 3)rep(k, 3){
            int nx = a + dx[j]; int ny = b + dy[k];
            if(1<nx && nx<h && 1<ny && ny<w) mp[P(nx, ny)]++;
        }
    }
    long cnt[10];
    rep(i, 10) cnt[i] = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++) cnt[itr->second]++;
    cnt[0] = (h-2) * (w-2);
    For(i, 1, 10) cnt[0] -= cnt[i];
    rep(i, 10) cout << cnt[i] << endl;
}

Measured memory_bytes: 56448
//日野茜★担当
//的場梨沙★担当
//結城晴★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>

using namespace std;

int main(void) {
    int N;
    cin>>N;
    vector<string>S(N);


    for(int i=0;i<N;i++){
        cin>>S[i];
    }

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


    int ans=1;
    for(int i=0;i<N;i++){
        if(S[i]!=S[i+1]){
            ans++;
        }
    }

    cout<<ans-1<<endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
using __gnu_pbds::gp_hash_table;

using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

template <typename T>
using V = std::vector<T>;
template <typename T>
vector<T> make_vec(size_t n, T a) {
  return vector<T>(n, a);
}
template <typename... Ts>
auto make_vec(size_t n, Ts... ts) {
  return vector<decltype(make_vec(ts...))>(n, make_vec(ts...));
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  for (auto &&e : v) os << e << ' ';
  return os << ']';
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << '[';
  for (auto &&e : v) os << e << ' ';
  return os << ']';
}

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

struct RollingHash {
  using u128 = __uint128_t;
  static const u64 mod = (1ULL << 61) - 1;
  const u64 base;
  vector<u64> hashed, power;

  RollingHash(const string &s, u64 base) : base(base) {
    int n = s.size();
    hashed.assign(n + 1, 0);
    power.assign(n + 1, 0);
    power[0] = 1;
    for (int i = 0; i < n; i++) {
      power[i + 1] = mul(power[i], base);
      hashed[i + 1] = add(mul(hashed[i], base), s[i]);
    }
  }

  static u64 gen_base() {
    random_device seed_gen;
    mt19937_64 engine(seed_gen());
    uniform_int_distribution<u64> rand(1, mod - 1);
    return rand(engine);
  }

  u64 add(u64 a, u64 b) {
    if ((a += b) >= mod) {
      a -= mod;
    }
    return a;
  }

  u64 mul(u64 a, u64 b) {
    u128 t = (u128)a * b;
    u64 na = t >> 61;
    u64 nb = t & mod;
    if ((na += nb) >= mod) {
      na -= mod;
    }
    return na;
  }

  // Returns the hash value for the [l,r) interval.
  u64 get(int l, int r) {
    return add(hashed[r], mod - mul(hashed[l], power[r - l]));
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  u64 rh_base = RollingHash::gen_base();

  int n;
  cin >> n;
  string s;
  cin >> s;
  RollingHash rh(s, rh_base);

  auto check = [&](int k) -> bool {
    gp_hash_table<u64, int> end_index;

    for (int i = 0; i + k <= n; ++i) {
      auto hashv = rh.get(i, i + k);
      auto it = end_index.find(hashv);
      if (it == end_index.end()) {
        end_index[hashv] = i + k;
        continue;
      }
      if (it->second <= i) {
        return true;
      }
    }
    return false;
  };

  int tv = 0, fv = n + 1;
  while (fv - tv > 1) {
    int mid = (tv + fv) / 2;
    if (check(mid)) {
      tv = mid;
    } else {
      fv = mid;
    }
  }
  cout << tv << endl;
}


Measured memory_bytes: 4220
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;

	int ans = 0;
	int n = 1;
	while (n < B) {
		n += A - 1;
		ans++;
	}

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


Measured memory_bytes: 256
#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 <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #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;

	vector<int> change;
	change.push_back(1);
	int yen6 = 6, yen9 = 9;
	for (int i = 0; i < 8; ++i) {
		if (yen6 <= 1e5) {
			change.push_back(yen6);
		}

		if (yen9 <= 1e5) {
			change.push_back(yen9);
		}

		yen6 *= 6;
		yen9 *= 9;
	}

	vector<int> dp(n + 1, 1e9);
	dp[0] = 0;
	for (int i = 0; i <= n; ++i) {
		for (auto val : change) {
			if (i + val <= n) {
				dp[i + val] = min(dp[i + val], dp[i] + 1);
			}
		}
	}

	cout << dp[n] << "\n";

	return 0;

}

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

int main() {
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    rep(i, n) cin >> x.at(i);
    y = x;
    sort(x.begin(), x.end());
    rep(i, n) {
        if(y.at(i) < x.at(n / 2)) cout << x.at(n / 2) << endl;
        else cout << x.at(n / 2 - 1) << endl;
    }
}

Measured memory_bytes: 3712
package main

import (
	"fmt"
)

func main() {
	var k int
	var s string
	fmt.Scanf("%d", &k)
	fmt.Scanf("%s", &s)

	if len(s) <= k {
		fmt.Printf("%s", s)
	} else {
		fmt.Printf("%s...", string([]rune(s)[:k]))
	}
}


Measured memory_bytes: 1824
import math
n, a, b = [int(item) for item in input().split()]
h = []
for i in range(n):
    h.append(int(input()))
alpha_d = a-b

def is_eliminatable(num):
    avr_d = num * b
    count = 0
    for item in h:
        hp = item - avr_d
        if hp > 0:
            count += math.ceil(hp / alpha_d)
        if count > num:
            return False
    return True

r = 10**15
l = -1 
while (r-l > 1):
    mid = l + (r - l) // 2
    if is_eliminatable(mid):
        r = mid
    else:
        l = mid
print(r)

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

using namespace std;

#define MXN 200005
#define x first
#define y second
// #define debug

typedef pair<int,int> PII;

int l[MXN], r[MXN], d[MXN];
vector<PII> edges[MXN];
map<int, int> pos;

bool dfs(int cur, int x) {
    for (PII nxt : edges[cur]) {
        if (pos.count(nxt.x)) {
            if (x+nxt.y != pos[nxt.x])
                return 1;
        } else {
            pos[nxt.x] = x+nxt.y;
            if (dfs(nxt.x, x+nxt.y))
                return 1;
        }
    }
    return 0;
}

int main() { 
    int n, m;
    while (cin >> n >> m) {
        bool bad = 0;
        for (int i = 0; i < m; ++i) { 
            cin >> l[i] >> r[i] >> d[i];
            edges[l[i]].push_back({r[i], d[i]});
            edges[r[i]].push_back({l[i], -d[i]});
        }
        for (int i = 0; i < m; ++i) {
            if (!pos.count(l[i])) {
                pos[l[i]] = 0;
                bad = bad || dfs(l[i], 0);
            }
        }
#ifdef debug
        for (auto it : pos) cout << it.x << " " << it.y << "\n";
#endif
        if (bad) cout << "No\n";
        else cout << "Yes\n";
        for (int i = 1; i <= n; ++i) edges[i].clear();
        pos.clear();
    }

    return 0;
}


Measured memory_bytes: 23808
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    string str;
    int flag=0;
    cin >> str;
    for(int i=1; i<str.size(); i++){
        if(str[i-1]=='A'&&str[i]=='C')flag=1;
    }
    cout << (flag?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    n = int(input())
    s_s = list(input())

    # work_s = str(s)

    for i in range(101):
        j = 0
        c = 0
        for cnt, s in enumerate(s_s):
            if s == "(":
                c += 1
            else:
                j += 1
            if c < j:
                s_s = ["("] + s_s
                break
            if cnt == len(s_s) - 1 and c > j:
                s_s = s_s + [")"]

    print("".join(s_s))
        # work_s = work_s.replace("()", "1")
        #
        # if i == 0:
        #     for j in range(100):
        #         work_s = work_s.replace("(X)", "X")
        # else:
        #     work_s = work_s.replace("(X)", "X")

        # テストクラス


class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """3
())"""
        output = """(())"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """6
)))())"""
        output = """(((()))())"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """8
))))(((("""
        output = """(((())))(((())))"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


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

using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') {
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3600
/*Saurav Paul*/
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define boost		          ios_base::sync_with_stdio(0);
#define eb                    emplace_back
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1e9+7
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);
using namespace std;

const int nax = 2000+1;
char s[nax][nax];
int dp[nax][nax];
int h , w;
int main()
{
	
	scanf("%d%d",&h,&w);
	for(int i =0 ; i < h ; i++)
		scanf("%s",s[i]);
	
	int maxi = 0;
	for (int i = 0 ; i < h ; i++){
		for(int j= 0 ; j < w ; j++){					
			if(s[i][j]=='#')
				continue ;
			int cnt = 0,st= j;
			while(j < w){
				if(s[i][j]=='#')
					break;
				cnt++;
				j++;
			}
			for(st=st ; st < j ; st ++)
				dp[i][st] +=cnt ;
		}
	}

	for (int i = 0 ; i < w ; i++){
		for(int j= 0 ; j < h ; j++){	

			if(s[j][i]=='#')
				continue ;
			int cnt = 0,st= j;
			while(j < h){
				if(s[j][i]=='#')
					break;
				cnt++;
				j++;
			}
			for(st=st ; st < j ; st ++){
				dp[st][i] +=cnt ;
				maxi = max(maxi, (int)dp[st][i]);
			}
		}
	}

	//~ for(int i = 0 ; i < h ; i++)
		//~ for(int j = 0 ; j < w ; j++)
			//~ maxi = max(maxi, (int)dp[i][j]);

	printf("%d\n",maxi-1);
    return 0;
}


Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long mod = 1e9+7;
const int maxn=2e5+7;

long int sad(vector<int> &arr,int b){
    long int sad_value = 0;
    for(int i=0;i<arr.size();i++){
        sad_value+=abs(arr[i] - (b+i));
    }
    return sad_value;
}

int main(){
    long lo=-1e9,hi=1e9;
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    long int psad,sadv,nsad;
    while(lo<=hi){
        int b = lo + (hi-lo)/2;
        if(b==0 || b==1e9){
            sadv = sad(arr,b);
        }
        psad = sad(arr,b-1);
        sadv = sad(arr,b);
        nsad = sad(arr,b+1);
        // cout<<psad<<' '<<sadv<<' '<<nsad<<' '<<b<<endl;
        if(psad>=sadv && sadv<=nsad){
            break;
        }
        else if(psad>sadv && sadv >nsad){
            lo = b+1;
        }
        else{
            hi = b-1;
        }
    }
    cout<<sadv;
}

Measured memory_bytes: 4040
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	while(cin >> n,n){
		set<int> a,b;
		vector<int> used(2*n+1,0);
		for(int i=0;i<n;i++){
			int x; cin >> x;
			used[x]++;
		}
		for(int i=1;i<=2*n;i++){
			if(used[i])a.insert(i);
			else b.insert(i);
		}
		int now=0;
		int turn=0;
		while(!a.empty()&&!b.empty()){
			if(turn%2==0){
				auto it=a.lower_bound(now);
				if(it==a.end()){
					now=0;
				}
				else{
					now=*it;
					a.erase(*it);
				}
				turn++;
			}
			else{
				auto it=b.lower_bound(now);
				if(it==b.end()){
					now=0;
				}
				else{
					now=*it;
					b.erase(*it);
				}
				turn++;
			}
		}
		cout << b.size() << endl << a.size() << endl;
	}
}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	vector<ll> a(n), b(n);
	REP(i, n) cin >> a[i];
	REP(i, n) cin >> b[i];
	ll cntA = 0;
	ll cntB = 0;
	REP(i, n) {
		if (a[i] > b[i]) cntA += a[i] - b[i];
		else if (a[i] < b[i]) cntB += (b[i] - a[i]) / 2;
	}

	if (cntA <= cntB) cout << "Yes" << '\n';
	else cout << "No" << '\n';
	return 0;
}

Measured memory_bytes: 3764
N = int(input())
A = list(map(int,input().split()))
 
ans = 1
sumDiff = 0	#この値の符号によって単純非減少、単純非増加を判定
		#初期や区切った直後は0でそこからdiffを積み上げる。符号が異なる場合を前で除いているので
		#絶対値的に大きくだけで符号は変わらない。0のときも問題なく適用できる
for i in range(1,len(A)):
	
	diff = A[i]-A[i-1]
	if sumDiff*diff < 0:		#sumDiff,diff=(正,負),(負,正)のときだけ成立 どちらかが0の場合非成立
		ans += 1
		sumDiff = 0		#sumDiffをリセット(区切った直後にまた区切ることはないので、
					#0だとこの分岐に引っかからないようにした)
	else:
		sumDiff += diff		#代入だと0のとき符号が維持できない。加算することで符号が維持できる
 
print(ans)

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

vector<pair<long long, long long> > prime_factorize(long long n) {
  vector<pair<long long, long long> > res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    int num = 0;
    while (n % p == 0) { ++num; n /= p; }
    res.push_back(make_pair(p, num));
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}

void solve(long long N, long long P){
  vector<pair<ll,ll>> v = prime_factorize(P);
  ll ans = 1;
  for(auto p : v) {
    ans *= pow(p.first, p.second / N);
  }
  std::cout << ans << std::endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long P;
    scanf("%lld",&P);
    solve(N, P);
    return 0;
}


Measured memory_bytes: 4172
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

struct edge{
    int to;
    long double cost;
};

int V = 10000;
vector<edge> G[10000];
long double d[10000];

void dijkstra(int s){
    priority_queue<pair<int,long double>, vector<pair<int,long double>>, greater<pair<int,long double>>> que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push({0, s});
    while (!que.empty()){
        auto p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++){
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push({d[e.to], e.to});
            }
        }
    }
}

int main(){
    long double xs,ys,xt,yt;
    cin >> xs >> ys >> xt >> yt;
    int N;
    cin >> N;
    vector<long double> x(N),y(N),r(N);
    rep(i,N) cin >> x[i] >> y[i] >> r[i];
    rep(i,N-1){
        for(int j = i+1; j < N; j++){
            long double xd = x[i] - x[j];
            long double yd = y[i] - y[j];
            long double dd = pow(xd*xd + yd*yd, 0.5);
            dd -= r[i] + r[j];
            if(dd < 0) dd = 0;
            G[i+1].push_back({j+1,dd});
            G[j+1].push_back({i+1,dd});
        }
    }
    rep(i,N){
        long double xd = x[i] - xs;
        long double yd = y[i] - ys;
        long double dd = pow(xd * xd + yd * yd, 0.5);
        dd -= r[i];
        if (dd < 0) dd = 0;
        G[i + 1].push_back({0, dd});
        G[0].push_back({i + 1, dd});
        xd = x[i] - xt;
        yd = y[i] - yt;
        dd = pow(xd * xd + yd * yd, 0.5);
        dd -= r[i];
        if(dd < 0) dd = 0;
        G[i + 1].push_back({N + 1, dd});
        G[N + 1].push_back({i + 1, dd});
    }
    long double xd = xs - xt;
    long double yd = ys - yt;
    long double dd = pow(xd * xd + yd * yd, 0.5);
    G[0].push_back({N+1,dd});
    G[N+1].push_back({0,dd});
    dijkstra(0);
    cout << setprecision(10) << d[N+1] << endl;
}

Measured memory_bytes: 44728
#include <bits/stdc++.h>
using namespace std;
unsigned long long fact(int num){
	if(num==0) return 1;
	return num*fact(num-1);
}
int main(){
	unsigned long long n =0;
	cin>>n;
	n = fact(n);
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 3016
<?php
  fscanf(STDIN,"%d %d", $n, $d);
  $one_look = $d*2+1;
  if ($n%$one_look == 0){
    echo ((int)($n/$one_look))."\n";
  }else{
    echo ((int)($n/$one_look)+1)."\n";
  }
  ?>


Measured memory_bytes: 4604
/* ex4_3
   moka223711 */

#include <stdio.h>

int main(void){
    // 高さがn(n+1)/2[m](n=1,2,…,999)の999本の塔が西から順に立っている
    // 雪に埋もれていない塔の高さから雪が何m積もっているか求める
    // 雪に埋もれていない西側の塔の高さをheight_west、東側の塔の高さをheight_eastとする
    
    int height_west, height_east, dif, ans;
    scanf("%d %d", &height_west, &height_east);
    
    // 東側の塔の高さから西側の塔の高さを引き、差difを求める
    dif = height_east - height_west;
    
    // 差difから西側の塔の高さを求めて、雪に埋もれていない塔の高さを引くことで
    // 雪が何m積もっているかを求める
    ans = dif * (dif - 1) / 2 - height_west;
    printf("%d", ans);
    
    return 0;
}


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

#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl  "\n"

typedef long long int ll ;


const ll MOD = 1e9 + 7 ;

template <typename T> T pow(T x, T y)
{   int result=1,ans=1; while (y!=1){if (y&1){--y;result=(result*x)%MOD;}x=(x*x)%MOD;y/=2;} ans=(result*x)%MOD ; return ans;   }

void solve()
{
	ll n ;
	cin >> n ;
	if ( n == 1 ) { cout << 0 << endl ; return ; }
	ll ans = pow<ll>(10 , n)%MOD ;
	ans -= pow <ll>(9 , n)%MOD ;
	ans -= pow<ll>(9 , n)%MOD ;
	ans += pow<ll>(8 , n)%MOD ;
	while (ans < 0) ans += MOD ;
	cout << ans << endl ;
}  
int main()
{
	ios ;
	
    solve() ;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

int H, W;
string s[500];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W;
    for (int j = 0; j < H; ++j) {
        cin >> s[j];
    }

    cout << ".";
    for (int j = 1; j < W-1; ++j) cout << "#";
    cout << "." << endl;
    for (int j = 1; j < H-1; ++j) {
        cout << ".";
        for (int k = 1; k < W-1; ++k) {
            if (k % 2 == 1) {
                cout << "#";
            } else {
                cout << s[j][k];
            }
        }
        cout << "." << endl;
    }
    for (int j = 0; j < W; ++j) cout << ".";
    cout << endl << endl;

    for (int j = 0; j < W; ++j) cout << ".";
    cout << endl;
    for (int j = 1; j < H-1; ++j) {
        cout << ".";
        for (int k = 1; k < W-1; ++k) {
            if (k % 2 == 0) {
                cout << "#";
            } else {
                cout << s[j][k];
            }
        }
        cout << "." << endl;
    }
    cout << ".";
    for (int j = 1; j < W-1; ++j) cout << "#";
    cout << "." << endl;
    return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b==c) cout<<"1\n";
  else 
    if(a==b && a!=c || a==c && a!=b || b==c && b!=a) cout<<"2\n";
    else cout<<"3\n";
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
long long mPow(long long x, long long y){
  long long res = 1;
  x = x % mod;
  while (y){
    if (y & 1){
      res = (res*x)%mod;
    }
    y = y>>1;
    x = (x * x) % mod;
  } 
  return res;
}
long long ferm(long long x, long long y){
  long long res = 1;
  for (long long i = x; i > x - y; i--)
    res = res*i%mod;
  for (long long i = 1; i <= y; i++)
    res = (res*mPow(i, mod-2))%mod;
  return res;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long ans, n, a, b; 
  cin >> n >> a >> b;
  ans = mPow(2, n) - 1;
//  cout << ans << '\n';
  long long n1 = ferm(n, a);
//  cout << n1 << '\n';
  long long n2 = ferm(n, b);
 // cout << n2 << '\n';
  cout << (2*mod + ans - n1 - n2)%mod << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    S = str(input().strip())
    K = int(input())

    c = S[K-1]
    ans = ''
    for s in S:
        if s == c:
            ans += s
        else:
            ans += '*'

    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    private static long gcd(long x, long y) {
        if(x > y) {
            long tmp = x;
            x = y;
            y = tmp;
        }

        if(y % x == 0) return x;
        return gcd(x, y % x);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in = br.readLine().split(" ");
        long a = Long.parseLong(in[0]);
        long b = Long.parseLong(in[1]);
        long c = Long.parseLong(in[2]);
        long d = Long.parseLong(in[3]);

        long p = b - (a - 1);
        long q = b / c - (a - 1) / c;
        long r = b / d - (a - 1) / d;
        long lcm = c / gcd(c, d) * d;
        long s = b / lcm - (a - 1) / lcm;

        System.out.println(p - q - r + s);
    }
}

Measured memory_bytes: 22612
//****************************//
/**********  main *************/
//****************************//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
 
using namespace std;
typedef long long ll;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())


int main() {

	std::cin.tie(0);
    
    int x,y,z;
    int a,b,c;

    cin >> x >> y >>z;

    cout << z << " " << x << " " <<  y << endl;


    

    return 0;
}

Measured memory_bytes: 256