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

int main() {
  string alpha="abcdefghijklmnopqrstuvwxyz";
  char c;
  cin >> c;

  for(int i=0;i<25;i++){
    if(c==alpha[i])
      cout << alpha[i+1] << endl;
  }
}

Measured memory_bytes: 256
import math
import sys
input = sys.stdin.readline

N, M, L = list(map(int, input().split()))

T = []
T1 = []
for _ in range(N):
    T.append([float("inf")] * N)
    T1.append([float("inf")] * N)
for n in range(N):
    T[n][n] = 0
    T1[n][n] = 0

for _ in range(M):
    A, B, C = list(map(int, input().split()))
    A -= 1
    B -= 1
    T[A][B] = C
    T[B][A] = C

for k in range(N):
    for i in range(N):
        for j in range(N):
            if T[i][j] > T[i][k] + T[k][j]:
                T[i][j] = T[i][k] + T[k][j]

for j in range(N):
    for i in range(N):
        if i == j:
            continue
        if T[j][i] <= L:
            T1[j][i] = 1
            T1[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            if T1[i][j] > T1[i][k] + T1[k][j]:
                T1[i][j] = T1[i][k] + T1[k][j]

Q = int(input())
for _ in range(Q):
    S, G = list(map(int, input().split()))
    if math.isinf(T1[S-1][G-1]):
        print(-1)
    else:
        print(T1[S-1][G-1]-1)


Measured memory_bytes: 83676
import bisect

N,M,K=map(int,input().split())
list_a=list(map(int,input().split()))
list_b=list(map(int,input().split()))

#Aの山の累積和を作成(Kを超えたらSTOP)
totaltime_a=[0]
for a in list_a:
    temp_a=totaltime_a[-1]+a
    if temp_a>K:
        break
    else:
        totaltime_a.append(temp_a)

totaltime_b=[0]
for b in list_b:
    totaltime_b.append(totaltime_b[-1]+b)

ans=0

for i in range (len(totaltime_a)):
    Kb=K-totaltime_a[i]
    j=bisect.bisect_right(totaltime_b,Kb)-1
    if i+j>ans:
        ans=i+j
    else:
        pass

print(ans)

Measured memory_bytes: 40764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
        sort(a,a+n);

        int ans=0;
    for(int i=0;i<n-2;i++)
        for(int j=i+1;j<n-1;j++)
        for(int k=j+1;k<n;k++)
    {
        if(a[k]<a[i]+a[j] && a[i]!=a[j] && a[j]!=a[k])
            ans++;

    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int K = int.Parse(str[1]);
		string s = Console.ReadLine();
		string s1 = s.Substring(0,1);
		int ct = 0;
		for(var i=1;i<N;i++){
			if(s1!=s.Substring(i,1)){
				ct++;
			}
			s1 = s.Substring(i,1);
		}
		int a1 = N-ct-1;
		a1 += K*2;
		a1 = Math.Min(a1,N-1);
		Console.WriteLine(a1);
	}
}

Measured memory_bytes: 15328
package main

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

func main() {
	const m = 1000000007

	N := readInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = readInt()
	}

	result := 0
	for bit := 0; bit < 60; bit++ {
		bitSum := 0
		for i := 0; i < N; i++ {
			bitSum += (A[i] >> uint(bit)) & 1 // bitSum <= 3 * 10^5
		}

		t := bitSum * (N - bitSum) // t <= 2.25 * 10^10
		t %= m
		t *= (1 << uint(bit)) % m
		t %= m

		result += t
		result %= m
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


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

int main(){
  int n;
  cin>>n;
  ll vec[n];
  for(int i=0;i<n;i++){
    cin>>vec[i];
  }
  sort(vec,vec+n);
  ll ans=0;
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(vec[i]!=vec[j]&&vec[j]!=vec[k]&&vec[k]!=vec[i]){
          if(vec[i]+vec[j]>vec[k]){
            ans++;
          }
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	int n;string s,t;cin>>n>>s>>t;
	for(int i=0;i<n;i++){
		bool f = 1;
		for(int j=0;i+j<n;j++){
			if(t[j]!=s[i+j]){
				f=0; break;
			}
		}
		if(f){
			cout<<n+i;
			return 0;
		}
	}
	cout<<n+n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

// get<K>(tuple型の変数)

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int a, b; cin >> a >> b;
    if(a <= 9 && b <= 9) cout << a * b << endl;
    else cout << -1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int gcd(const int &a, const int &b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
int lcd(const int &a, const int &b) {
	return a / gcd(a, b) * b;
}

int main() {
	int n;
	std::cin >> n;
	int largest = 1;
	for (auto i = 0; i < n; ++i) {
		int a;
		std::cin >> a;
		largest = lcd(largest, a);
	}
	std::cout << largest << std::endl;
	return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int i,n,a[1000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=n-1;i>=1;i--){
        printf("%d ",a[i]);
    }
    printf("%d",a[0]);
    printf("\n");
    return 0;
}



Measured memory_bytes: 2072
class UnionFindNode(object):
    """
    Union-Find構造
    ノードのグループ併合や、所属グループ判定を高速に処理する
    """

    def __init__(self, group_id, parent=None, value=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.value = value
        self.size_ = 1

    def __str__(self):
        template = "UnionFindNode(group_id: {}, \n\tparent: {}, value: {}, size: {})"
        return template.format(self.group_id_, self.parent_, self.value, self.size_)

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        parent = self.root()
        return parent.group_id_

    def size(self):
        parent = self.root()
        return parent.size_

    def unite(self, unite_node):
        parent = self.root()
        unite_parent = unite_node.root()

        if parent.group_id_ != unite_parent.group_id_:
            if parent.size() > unite_parent.size():
                unite_parent.parent_ = parent
                parent.size_ = parent.size_ + unite_parent.size_
            else:
                parent.parent_ = unite_parent
                unite_parent.size_ = parent.size_ + unite_parent.size_

    def same(self, node):
        return self.root() == node.root()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = list(zip(a, b))
l.sort(key=lambda x: x[1])
a.sort()
d = dict()
for i, x in enumerate(a):
    d[x] = i
b.sort()
for i in range(n):
    if a[i] > b[i]:
        print('No')
        exit(0)
for i in range(n - 1):
    if a[i + 1] <= b[i]:
        print('Yes')
        exit(0)
uf = [UnionFindNode(i) for i in range(n)]
al = [d[x[0]] for x in l]
for i in range(n):
    uf[i].unite(uf[al[i]])
if uf[0].root().size() == n:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 58064
def combination(n, k, p):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % p
 
    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % p
 
    return (numerator * pow(denominator, p-2, p)) % p
 
 
X, Y = map(int, input().split())
 
a = (2*Y-X) / 3
b = (2*X-Y) / 3
 
if a >= 0 and b >= 0 and a == int(a) and b == int(b):
    a = int(a)
    b = int(b)
 
    print(combination(a+b, a, 10**9+7))
else:
    print(0)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int i,j,k;
	int a,b,c=0;
	scanf("%d %d",&a,&b);
	if(a!=0||b!=0){
	do
	{
		for(i=1;i<=a;i++){
			for(j=i+1;j<=a;j++){
				for(k=j+1;k<=a;k++){
					if(i!=j&&j!=k&&i!=k)
					{if((i+j+k)==b)c++;}
				}
			}
		}
		printf("%d\n",c);
		c=0;
		scanf("%d %d",&a,&b);
	}while(a!=0||b!=0);
	}
return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#include <queue>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
{
    return x>y;
}
const int N=55;
const int mod=1e9+7;
char A[101],B[101],C[101];
int main()
{
    int a,b,c;
    int la,lb,lc;
    while(cin>>A>>B>>C){
        int tmp;
        la=strlen(A),lb=strlen(B),lc=strlen(C);
        tmp=1,a=b=c=-1;
        while(1){
            if(a==la){
                cout<<"A"<<endl;
                break;
            }
            else if(b==lb){
                cout<<"B"<<endl;
                break;
            }
            else if(c==lc){
                cout<<"C"<<endl;
                break;
            }
            if(tmp==1){
                a++;
                tmp=A[a]-'a'+1;
            }
            else if(tmp==2){
                b++;
                tmp=B[b]-'a'+1;

            }
            else if(tmp==3){
                c++;
                tmp=C[c]-'a'+1;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int sort(const void *A,const void *B){return *(long long*)A>*(long long*)B?1:0;}

int main(void){
    int n;
    scanf("%d",&n);
    long long a[n],v[n],ans=0;
    for (int i=0; i<n; i++){
        scanf("%lld",&a[i]);
        v[i]=0;
    }
    qsort (a,n,sizeof(long long),sort);
    for (int i=31; i>=0; i--){
        long long count=0,back=n-1,sum=pow(2,i);
        while(count<back){
            if (v[count]==1){
                count++;
            } else if (v[back]==1){
                back--;
            } else if (a[count]+a[back]==sum){
                v[count]=1;
                v[back]=1;
                ans++;
                count++;
                back--;
            } else if (a[count]+a[back]<sum){
                count++;
            } else {
                back--;
            }
        }
    }
    printf("%lld\n",ans);
	return 0 ;
}

Measured memory_bytes: 4860
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
  char s[11];
  scanf("%s",&s);
  int i,j;
  for(i=0;s[i];++i)
  {  
      
      if(s[i]=='B')
       {
        for(j=i-1;j>=0;--j)
          {
               if(s[j]=='0'||s[j]=='1')
                   { s[j]='*';
                      break;
                   }
          }
       }
  }
  
  for(i=0;s[i];++i)
    {
        if(s[i]=='0' || s[i]=='1')
            printf("%c",s[i]);
    }
   
}

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

int main() {
  ll a[3],m[3];
  while(1) {
    for(int i=0; i<3; i++) cin >> a[i] >> m[i];
    if(!a[0]) break;
    ll ans=1;
    for(int i=0; i<3; i++) {
      ll x=a[i],c=1;
      while(x!=1) {
        x=x*a[i]%m[i];
        c++;
      }
      ans=c/__gcd(ans,c)*ans;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 1156
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        sc.close();

        // 主処理
        int count = 0;
        for (int i = 0; i < s.length(); i++) {
            String s1 = s.substring(0, i);
            String s2 = s.substring(i, s.length());
            count = Math.max(getDoubleCount(s1, s2), count);
        }

        int result = count;

        // 出力
        System.out.println(result);
    }

    public static int getDoubleCount(String s1, String s2) {
        List<String> list1 = new ArrayList<>(new HashSet<>(Arrays.asList(s1.split(""))));
        List<String> list2 = new ArrayList<>(new HashSet<>(Arrays.asList(s2.split(""))));

        int count = 0;
        for (String s : list2) {
            if (list1.contains(s)) {
                count++;
            }
        }

        return count;
    }
}


Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
#define int ll
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif
 
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
 
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
 
using pi=pair<int,int>;
using vi=vc<int>;
 
template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}
 
template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}
 
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
 
	int n,k;cin>>n>>k;
	vi p(n);
	rep(i,n)cin>>p[i];
 
	vi t(n-k+1);
	{
		int cnt=0,j=1;
		rep(i,n-k+1){
			while(j<i+k){
				if(p[j-1]>p[j])
					cnt++;
				j++;
			}
			t[i]=cnt;
			if(p[i]>p[i+1])
				cnt--;
		}
	}
	vi sm(n-k+1);
	{
		set<int> s;
		int j=0;
		rep(i,n-k){
			while(j<i+k+1)
				s.insert(p[j++]);
			if(*s.bg==p[i]&&*prev(s.ed)==p[j-1])
				sm[i+1]=1;
			s.erase(p[i]);
		}
	}
	int ans=0,z=0;
	rep(i,n-k+1)if(!sm[i]){
		if(t[i])ans++;
		else z++;
	}
	ans+=bool(z);
	cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

#define MAX 20

signed main() {
    int n;
    cin >> n;
    int x[n];
    rep(i, n) {
        cin >> x[i];
    }
    int l, q;
    cin >> l >> q;
    int a[q], b[q];
    rep(i, q) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        if (a[i] > b[i]) swap(a[i], b[i]);
    }
    int dp[n][MAX + 1];
    rep(i, n) {
        dp[i][0] = upper_bound(x, x + n, x[i] + l) - x - 1;
    }
    for (int i = 0; i < MAX; i++) {
        for (int j = 0; j < n; j++) {
            dp[j][i + 1] = dp[dp[j][i]][i];
        }
    }
    rep(i, q) {
        int ans = 0, cur = a[i];
        for (int j = MAX; j >= 0; j--) {
            if (dp[cur][j] < b[i]) {
                cur = dp[cur][j];
                ans += 1 << j;
            }
        }
        cout << ans + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 13024
#include<iostream>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int B, W;
ll fact[200001], fact_inv[200001];
ll whiteover[200001], blackover[200001];
ll white_sum[200001], black_sum[200001];

ll modpow(ll a, ll b) {
	ll rtn = 1, x = a;
	while (b > 0) {
		if (b & 1)rtn *= x, rtn %= MOD;
		x *= x;
		x %= MOD;
		b >>= 1;
	}
	return rtn;
}

ll comb(ll a, ll b) {
	ll ans = (fact[a] * fact_inv[a - b]) % MOD;
	ans = (ans * fact_inv[b]) % MOD;
	return ans;
}

void calc_fact_and_inv() {
	fact[0] = 1;
	fact[1] = 1;
	for (int i = 2; i <= 200000; i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= MOD;
	}
	fact_inv[200000] = modpow(fact[200000], MOD - 2);
	for (int i = 199999; i >= 0; i--) {
		fact_inv[i] = fact_inv[i + 1] * (i + 1);
		fact_inv[i] %= MOD;
	}
}

void calc_combination() {
	for (int i = W; i <= B + W; i++) {
		whiteover[i] = (comb(i - 1, W - 1) * modpow(2, B + W - i)) % MOD;
		white_sum[i] = (white_sum[i - 1] + whiteover[i]) % MOD;
	}
	
	for (int i = B; i <= B + W; i++) {
		blackover[i] = (comb(i - 1, B - 1) * modpow(2, B + W - i)) % MOD;
		black_sum[i] = (black_sum[i - 1] + blackover[i]) % MOD;
	}
}

int main() {

	calc_fact_and_inv();

	cin >> B >> W;
	
	calc_combination();

	const ll denominator = modpow(2, B + W);

	for (int i = 1; i <= B + W; i++) {

		ll ans;
		ans = ((denominator + white_sum[i - 1] - black_sum[i - 1] + MOD * 10) % MOD)
			* modpow(2, MOD - 2);
		ans %= MOD;
		cout << (ans * modpow(denominator, MOD - 2)) % MOD << endl;
	}

	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;


void solve(ll n){
	string str;
	cin >> str;
	str = "1" + str;
	ll cou = 0;
	ll now = 0;
	ll tmp;
	REP(i,str.size())if(str[str.size()-i-1] == '1')now += (1LL << i);
	tmp = now;
	while(1){
		ll alfer = ((1LL << 53) - now) / tmp;
		if(((1LL << 53) - now) % tmp == 0)alfer--;
		if(alfer >= n){
			now += n * tmp;
			break;
		}
		else{
			now += (alfer + 1) * tmp;
			n -= alfer + 1;
			cou++;
			tmp /= 2;
			now /= 2;
			if(tmp == 0)break;
		}
	}
	for(int i = 11;i >= 0;i--){
		if(cou & (1LL << i))cout << 1;
		else cout << 0;
	}
	for(int i = 51;i >= 0;i--){
		if(now & (1LL << i))cout << 1;
		else cout << 0;
	}
	cout << endl;
}

int main(){
	ll n;
	while(cin >> n,n){
		solve(n);
	}
	return 0;
}


Measured memory_bytes: 3220
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
import bisect
import sys
import logging
import heapq

#logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n = int(input())
	t = [int(input()) for _ in range(n)]
	print(lcm(t))

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

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

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

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

	return True

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

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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

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

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

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

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()


Measured memory_bytes: 68204
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int main() {
	long long X;

	cin >> X;

	long long temp = 100, cnt = 1;
	while (1) {
		temp = temp + temp / 100;
		if (temp >= X) {
			cout << cnt << endl;
			return 0;
		}
		cnt++;
	}
	return 0;
}

Measured memory_bytes: 3576
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d",&a);
	scanf("%d",&b);
	if(a>=13){
		printf("%d\n",b);
	}
	else if(a<=5){
		printf("0\n");
	}
	else{
		b = b/2;
		printf("%d\n",b);
	}
	return 0;
}

Measured memory_bytes: 1688
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 5;

int a[N], ctr[N];

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

	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		ctr[a[i]]++;
	}

	int del = 0, pairs = 0;
	for (int i = 1; i < N; ++i)
	{
		if (ctr[i] > 1)
		{
			if (ctr[i] % 2 == 1)
			{
				del += ctr[i] - 1;
			}

			else
			{
				del += ctr[i] - 2;
				++pairs;
			}
		}
	}
	del += 2 * ((pairs + 1) / 2);
	cout << n - del;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
string s,t;
int n,m,d,mn;
int main()
{
    cin >> s >> t;
    n=s.length();
    m=t.length();
    mn=m;
    for(int i=0; i<n-m+1; i++){
        d=0;
        for(int j=0; j<m; j++) d+=(s[i+j]!=t[j]);
        mn=min(mn,d);
    }
    cout << mn;
    return 0;
}

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

int tower(int);

int A[999];


int main(){
  int a,b,c,d,x;
  cin >> a >> b ;
  d = b - a;

  for(int i=0; i<999; i++){
    A[i] = tower(i);
  }

  x = A[d-1] -a;
  cout << x ;
  return 0;
}
  


int tower(int n){
  if(n==0){return 0;}
  else{return tower(n-1)+n;}
 }


Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

int bitCount(int n) {
	n = ((n & 0xAAAAAAAA) >> 1) + (n & 0x55555555);
	n = ((n & 0xCCCCCCCC) >> 2) + (n & 0x33333333);
	n = ((n & 0xF0F0F0F0) >> 4) + (n & 0x0F0F0F0F);
	n = ((n & 0xFF00FF00) >> 8) + (n & 0x00FF00FF);
	return ((n & 0xFFFF0000) >> 16) + (n & 0x0000FFFF);
}

int get_dmax(int y, int m) {
	static const int dmax[] = {0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	if (m == 2) {
		if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) {
			return 29;
		} else {
			return 28;
		}
	} else {
		return dmax[m];
	}
}

/*
 0
1 2
 3
4 5
 6
*/
const int font[10] = {
	/*     6543210 */
	/* 0 : 1110111 */ 0x77,
	/* 1 : 0100100 */ 0x24,
	/* 2 : 1011101 */ 0x5D,
	/* 3 : 1101101 */ 0x6D,
	/* 4 : 0101110 */ 0x2E,
	/* 5 : 1101011 */ 0x6B,
	/* 6 : 1111011 */ 0x7B,
	/* 7 : 0100101 */ 0x25,
	/* 8 : 1111111 */ 0x7F,
	/* 9 : 1101111 */ 0x6F
};

int N;
int mask[14];

int render(int num, int digit, int offset) {
	int count = 0;
	int i;
	for (i = 0; i < digit; i++) {
		count += bitCount(font[num % 10] & mask[offset + digit - 1 - i]);
		num /= 10;
	}
	return count;
}

uint64_t hms_count[100];

int main(void) {
	int i, K;
	int y, m, d, h, s;
	uint64_t answer = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < 14; i++) mask[i] = 0x7F;
	if (scanf("%d", &K) != 1) return 1;
	for (i = 0; i < K; i++) {
		int p, q;
		if (scanf("%d%d", &p, &q) != 2) return 1;
		mask[p] &= ~(1 << q);
	}

	for (h = 0; h <= 23; h++) {
		for (m = 0; m <= 59; m++) {
			for (s = 0; s <= 59; s++) {
				int count = render(h, 2, 8) + render(m, 2, 10) + render(s, 2, 12);
				hms_count[count]++;
			}
		}
	}

	for (y = 0; y <= 9999; y++) {
		for (m = 1; m <= 12; m++) {
			int dmax = get_dmax(y, m);
			for (d = 1; d <= dmax; d++) {
				int ymd_count = render(y, 4, 0) + render(m, 2, 4) + render(d, 2, 6);
				if (ymd_count <= N) answer += hms_count[N - ymd_count];
			}
		}
	}

	printf("%"PRIu64"\n", answer);
	return 0;
}

Measured memory_bytes: 604
void main() {
	auto N = ri;
	auto P = iota(N).map!(a => ri).array;
	auto dp = new int[](N+1);
	int res = int.max;
	foreach(i; 0..N) {
		debug writeln(dp);
		dp[P[i]] = dp[P[i] - 1] + 1;
		res = min(res, N - dp[P[i]]);
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

T[] deepcopy(T)(T[] a) {
	static if(isArray!T) {
		T[] res;
		foreach(i; a) {
			res ~= deepcopy(i);
		}
		return res;
	} else {
		return a.dup;
	}
}

ulong[] generate_prime_list(T)(T N) if(isIntegral!T) {
	ulong[] prime_list = [2];
	bool not_prime = false;
	foreach(i; 3..N.to!ulong+1) {
		foreach(j; prime_list) {
			if(i % j == 0) {
				not_prime = true;
				break;
			}
		}
		if(!not_prime) prime_list ~= i;
		not_prime = false;
	}
	return prime_list;
}

bool isPrime(ulong n) {
	if(n <= 1) return false;
	else if(n == 2) return true;
	else if(n % 2 == 0) return false;

	foreach(i; iota(3, n.to!double.sqrt.ceil+1, 2)) {
		if(n % i == 0) return false;
	}
	return true;
}

class UnionFind(T) {
	T[] arr;
	this(ulong n) {
		arr.length = n+1;
		arr[] = -1;
	}
	T root(T x) {
		return arr[x] < 0 ? x : root(arr[x]);
	}
	bool same(T x, T y) {
		return root(x) == root(y);
	}
	bool unite(T x, T y) {
		x = root(x);
		y = root(y);
		if(x == y) return false;
		if(arr[x] > arr[y]) swap(x, y);
		arr[x] += arr[y];
		arr[y] = x;
		return true;
	}
	T size(T a) {
		return -arr[root(a)];
	}
}


Measured memory_bytes: 4860
import java.util.*;
import java.math.BigInteger;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    BigInteger[] numbers = new BigInteger[n];
    BigInteger max = new BigInteger("1000000007");
    for (int i = 0; i < n; i++) {
      numbers[i] = sc.nextBigInteger();
    }
    BigInteger ans = BigInteger.ZERO;
    BigInteger tmp = BigInteger.ZERO;
    for (int i = 0; i < n-1; i++) {
      tmp = tmp.add(numbers[i]);
      ans = ans.add(numbers[i+1].multiply(tmp));
      tmp = tmp.mod(max);
    }
    System.out.println(ans.mod(max));
  }
}


Measured memory_bytes: 74052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll ans = 1e18;
    for (int i = 0; i < n; i++) {
        ll lo = 0, hi = 1e17;
        while (hi - lo > 1) {
            ll md = (hi + lo) / 2;
            ll mid = md * n + i;
            ll mx = n - 1 - mid;
            ll cnt = 0;
            for (int i = 0; i < n; i++) {
                cnt += (a[i] - mx + n) / (n + 1);
            }
            if (cnt >= mid) {
                lo = md;
            } else {
                hi = md;
            }
        }
        ans = min(ans, lo * n + i - 1);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
//abc162B
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void) {
  int k, i, len, tmp, r=0, g=0, b=0;
  char n[4000];
  long long sum=0;
  scanf("%d %s", &len, n);

  int s[len];
  for(i=0; i < len; ++i){
    if(n[i] == 'R'){
      s[i]=0;
      r++;
    }else if(n[i] == 'G'){
      s[i]=1;
      g++;
    }else{
      s[i]=2;
      b++;
    }
    //printf("%d %c\n",s[i], n[i]);
  }
  //printf("R G B:%d %d %d\n\n", r, g, b);

  for(i=0; i < len; i++){
    for(k=i + 1; k < len; k++){

      if((s[i] == 0 && s[k] == 1) || (s[i] == 1 && s[k] == 0)){
        if(2 * k - i < len && s[2 * k - i] == 2){
          //printf("xxx  %d %d %d\n", i, k, 2 * k - i);
          sum--;
        }
        if((i + k) % 2 == 0 && s[(i + k) / 2] == 2){
          //printf("ttt  %d %d %d\n", i, (i + k) / 2, k);
          sum--;
        }
        if((2*i-k) >=0 && s[2*i-k] == 2){
          //printf("ttt  %d %d %d\n", i, (i + k) / 2, k);
          sum--;
        }

        sum+=b;

        //printf("%d %d %d\n", i, k, 2 * k - i);
      }
    }
  }
  printf("%lld\n", sum);
}


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

signed main() 
{
	int h , w , k;
    cin >> h >> w >> k;
    char grid[h][w];
    rep(i,h)
        rep(j,w)
            cin >> grid[i][j];
    int t1 = pow(2,h) , t2 = pow(2,w) , ans = 0;
    rep(i,t1)
        rep(j,t2)
        {
            int ft = 0;
            rep(x,h)
                rep(y,w)
                {
                    if(grid[x][y]=='.')
                        continue;
                    if(( ((int)pow(2,x)&i) != (int)pow(2,x)) && (((int)pow(2,y) & j) != (int)pow(2,y)))
                        ft++;
                }
            if(ft==k)
                ans++;
        }
    cout << ans << endl;
}

Measured memory_bytes: 4060
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll t;

int main(){
	cin>>t;
	ll x=100,res=0;
	while(x<t){
		x+=x/100;
		res++;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
//#define rem 998244353
#define cont continue
const ll INF=(1ll<<60)-1;//ll ans = 3e18 + 5;
////////////////////////////////////////////////////////////////////////////////////////
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*ll tc;
    cin>>tc;
    while(tc--)
    {}*/
    ll n,k;
    cin>>n>>k;
    ll cnt[n+1]={};
    rep(i,0,k)
    {
        ll x;
        cin>>x;
        while( x-- )
        {
            ll y;
            cin>>y;
            cnt[y]++;
        }
    }
    ll ans=0;
    rep(i,1,n+1)
    if( cnt[i]==0 )
    ans++;
    cout<<ans;
}


Measured memory_bytes: 3652
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,K;
LL A[200001];

vector<string> ans;

void solve(){
	LL first = A[1];
	for(int i=K+1;i<=N;i++){
		if(first<A[i]) ans.push_back("Yes");
		else ans.push_back("No");
		first = A[i+1-K];
	}
}

int main(){
    cin >> N >> K;
    for(int i=1;i<=N;i++) cin >> A[i];

    solve();

    for(int i=0;i<ans.size();i++)cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 10636
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,K;
LL A[100001];
bool check=false;
LL gcd(LL a,LL b){
   if(b==0)return a;
   return gcd(b,a%b);
}
int main(){
    cin>>N>>K;
    REP(i,N){
        cin>>A[i];
        if(A[i]>=K)check=true;
    }
    LL now=A[0];
    REP(i,N){
        now=gcd(A[i],now);
    }
    if(K%now==0&&check){
       cout<<"POSSIBLE"<<endl;
    }else{
       cout<<"IMPOSSIBLE"<<endl;
    }
    return(0);
}

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

struct Node {
  int parent;
  vector<int> children;
  int depth;
  int sibling;
};

void dfs(vector<Node>& tree, int p, int v) {
  tree[v].parent = p;
  if ( p >= 0 ) tree[v].depth = tree[p].depth+1;
  for ( int c: tree[v].children ) {
    dfs(tree, v, c);    
  }
}

string node_type(Node v) {
  if ( v.parent == -1 ) return "root";
  else if ( v.children.size() == 0 ) return "leaf";
  else return "internal node";
}

int calc_height(vector<Node>& tree, Node v) {
  if ( v.children.size() == 0 ) return 0;
  
  int ret = 0;  
  for ( int c: v.children ) {
    ret = max(ret, calc_height(tree, tree[c])+1);
  }

  return ret;
}

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

  vector<Node> tree(n);
  bool used[n] = {0};  
  for ( int i = 0; i < n; i++ ) {
    int id;
    cin >> id;
    int c1, c2;
    cin >> c1 >> c2;
    if ( c1 >= 0 ) {
      used[c1] = true;
      tree[id].children.push_back(c1);
      tree[c1].sibling = c2;
    }
    if ( c2 >= 0 ) {
      used[c2] = true;
      tree[id].children.push_back(c2);
      tree[c2].sibling = c1;
    }
  }

  // calc depth
  for ( int i = 0; i < n; i++ ) {
    if ( !used[i] ) {
      dfs(tree, -1, i);
      tree[i].sibling = -1;
      break;
    }
  }

  vector<int> cnt(n, 0);
  for ( int i = 0; i < n; i++ ) {
    cnt[tree[i].depth]++;
  }

  for ( int i = 0; i < n; i++ ) {
    Node v = tree[i];
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", i, v.parent, v.sibling, (int)v.children.size(), v.depth, calc_height(tree, v));
    cout << node_type(v) << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3280
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

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

    if(2*b >= a) {
        cout<<0<<endl;
    } else {
        cout<<a-2*b<<endl;
    }

    return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <cctype>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}



int main() {
	int n, k; cin >> n >> k;
	vector<int> l;
	int kk;

	for (int i = 0; i < n; i++) {
		cin >> kk;
		l.push_back(kk);
	}
	int sum = 0;
	sort(l.begin(), l.end(), std::greater<int>());
	//printVec(l);
	for (int i =0 ; i <k; i++) {
		sum += l[i];
	}
	cout << sum;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m=1e15,ans=0,count=0;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        ans+=abs(a[i]);
        m=min(m,abs(a[i]));
        if(a[i]<0){
            count++;
        }
    }
    count%=2;
    if(count){
        cout<<ans-m*2<<endl;
    }
    else{
        cout << ans<<endl;
    }


    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_5_C
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line ;
            while (true)
            {
                line = ReadIntAr();
                if (line[0] == 0 && line[1] == 0) return;

                for (int i = 0; i < line[0]; i++)
                {
                    string tmp = string.Empty;
                    for (int j = 0; j < line[1]; j++)
                    {
                        if ((i + j) % 2 == 0) tmp += "#";
                        else tmp += ".";
                    }
                    Console.WriteLine("{0}", tmp);
                }
                Console.WriteLine("{0}", "");
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



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

int main()
{
    int x[10010], y[10010],c=1;
    for (int i=1; ; i++)
    {
        cin>>x[i]>>y[i];
        if (x[i]==0 && y[i]==0) break;
        if (x[i]>y[i]) swap(x[i],y[i]);
        c++;
    }
    for (int i=1; i<c; i++) cout<<x[i]<<" "<<y[i]<<'\n';
    return 0;
}



Measured memory_bytes: 3048
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M; cin>>N>>M;
  ll A;
  pqueue<ll> que;
  for(int i=0;i<N;++i) {
    cin>>A;
    que.push(A);
  }
  for(int i=0;i<M;++i) {
    A = que.top();que.pop();
    A /= 2;
    que.push(A);
  }
  ll ans = 0;
  for(int i=0;i<N;++i) {
    A = que.top();que.pop();
    ans += A;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 4324
#include <iostream>

using namespace std ;

int main(void){
    int i,j;
    char c[3][3];

    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
            cin >> c[i][j];

    for(int i=0; i<3; i++)
        cout << c[i][i];

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int n; cin >> n;
    map <int, int> cnt;
    ll s = 0;
    FOR(i, 1, n) {
        int tt; cin >> tt;
        cnt[tt]++, s += tt;
    }
    int q; cin >> q;
    FOR(i, 1, q) {
        int b, c; cin >> b >> c;
        s += (c - b) * cnt[b];
        cnt[c] += cnt[b], cnt[b] = 0;
        cout << s << endl;
    }
}

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

const ll mod = 1e9 + 7;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N), p, n;
  rep(i, N) {
    cin >> A[i];
    if (A[i] >= 0) p.push_back(A[i]);
    else n.push_back(A[i]);
  }

  int pn = p.size();
  int nn = n.size();
  bool ok = false;
  if (pn > 0) {
    if (N == K) ok = (nn % 2 == 0);
    else ok = true;
  }
  else {
    ok = (K % 2 == 0);
  }

  ll ans = 1;
  if (ok) {
    sort(p.begin(), p.end());
    sort(n.rbegin(), n.rend());
    if (K % 2 == 1) {
      ans *= p.back();
      p.pop_back();
    }
    vector<ll> t;
    while (p.size() >= 2) {
      ll x = p.back();
      p.pop_back();
      x *= p.back();
      p.pop_back();
      t.push_back(x);
    }
    while (n.size() >= 2) {
      ll x = n.back();
      n.pop_back();
      x *= n.back();
      n.pop_back();
      t.push_back(x);
    }
    sort(t.rbegin(), t.rend());
    rep(i, K / 2) {
      ans = ((ans % mod) * (t[i] % mod)) % mod;
    }
  }
  else {
    sort(A.begin(), A.end(), [](int x, int y) {
      return abs(x) < abs(y); 
    });
    rep(i, K) {
      ans = (ans * A[i]) % mod;
      if (ans < 0) ans += mod;
    }
  }

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


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

int main() {
  int S ,s1 ,s2 ,s3 ,a ,b;
  cin >> S;
  s3 = S % 2;
  a  = ( S - s3 ) / 10;
  s2 = a % 2;
  b  = ( a - s2 ) / 10;
  s1 = b % 2;
  cout << s1 + s2 + s3 << endl;
}


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

using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;
const int N = 1e5;
int c[2][N], n;

int main() {
  memset(c, 0, sizeof(c));
  scanf("%d ", &n);
  REP(i,n) {
    int v;
    scanf("%d ", &v);
    if (i&1) c[1][v-1]++;
    else c[0][v-1]++;
  }
  priority_queue<pair<int, int>> po, pe;
  REP(i,N) {
    pe.push(mp(c[0][i],i));
    po.push(mp(c[1][i],i));
  }
  int res = 0;
  if (po.top().second != pe.top().second) {
    res = n - po.top().first - pe.top().first;
  } else {
    int x = po.top().first;
    int y = pe.top().first;
    po.pop(); pe.pop();
    int xx = po.top().first;
    int yy = pe.top().first;
    res = n - max(x+yy, xx+y);
  }
  printf("%d\n", res);
  return 0;
}

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

typedef long long ll;
#define REP(i, n) for(int i=0;i<n;i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)

int n;
ll p[2000];
ll table[2000][2000];

#define M(a) (((a)+n)%n)
#define DP(a, b) (table[M(a)][M(b)]>=0?table[M(a)][M(b)]:dp(M(a),M(b)))
ll dp(int a, int b){
	ll ret = 0;
	if(M(b-a)%2){
		if(p[M(a-1)]>p[M(b)]){
			ret = DP(a-1, b);
		}else{
			ret = DP(a, b+1);
		}
	}else{
		ret = max(p[M(a-1)]+DP(a-1, b), p[b]+DP(a, b+1));
	}
	return table[a][b]=ret;
}

int main(){
	scanf("%d", &n);
	REP(i, n) scanf("%lld", p+i);
	REP(i, n) REP(j, n) table[i][j]=-1;
	REP(i, n) table[i][i]=0;
	ll ans = 0;
	REP(i, n){
		ll ansnew = p[i] + DP(i, i+1);
		if(ans<ansnew) ans=ansnew;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 32540
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

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

int main(void){
	int H,W;
	string s[52];
	bool can=true;
	scanf("%d%d",&H,&W);
	rep(i,H){
		cin>>s[i];
	}
	rep(i,H){
		rep(j,W){
			if(s[i][j]=='#'){
				int exist=0;
				rep(k,4){
					if(i+dy[k]>=0 && i+dy[k]<=H-1 && j+dx[k]>=0 && j+dx[k]<=W-1 && s[i+dy[k]][j+dx[k]]=='#'){
						exist++;
					}
				}
				if(exist==0){
					can=false;
					break;
				}
				queue<mp> Q;
				s[i][j]='.';
				Q.push(make_pair(i,j));
				while(!Q.empty()){
					mp p = Q.front();
					Q.pop();
					int y=p.first, x=p.second;
					rep(k,4){
						if(y+dy[k]>=0 && y+dy[k]<=H-1 && x+dx[k]>=0 && x+dx[k]<=W-1 && s[y+dy[k]][x+dx[k]]=='#'){
							s[y+dy[k]][x+dx[k]]='.';
							Q.push(make_pair(y+dy[k],x+dx[k]));
						}
					}
				}
			}
		}
	}
	if(can){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256