akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#define LL long long
using namespace std;
int a[100005],n,m;
LL s[100005];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	int ans=(1<<31-1);
	for(int i=1;i<=n-m+1;i++)
	{
		int ed=i+m-1;
		ans=min(ans,abs(0-a[i])+a[ed]-a[i]);
		ans=min(ans,abs(0-a[ed])+a[ed]-a[i]);
	}
	printf("%d\n",ans);
	return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

bool is_prime(ll p) {
  if (p < 2) return false;
  if (p == 2) return true;
  if (p % 2 == 0) return false;
  for (ll i = 3; i <= sqrt(p); i+=2) {
    if (p % i == 0) {
      return false;
    }
  }
  return true;
}

int main() {
  ll q;
  cin >> q;

  vector<ll> l(q);
  vector<ll> r(q);
  for (ll i = 0; i < q; ++i) {
    cin >> l[i] >> r[i];
  }

  vector<ll> sum(100000);
  ll k = 0;
  for (ll i = 2; i <= 100000; ++i) {
    ll c = 0;
    if (is_prime(i) && is_prime((i+1)/2)) {
      ++c;
    }
    sum[i] = sum[i-1] + c;
  }

  for (ll i = 0; i < q; ++i) {
    cout << sum[r[i]]-sum[l[i]-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 2944
#include<iostream>

using namespace std;

int main(){
	int a, b, ans, box;
	
	cin >> a >> b;
	
	ans = a + b;
	
	box = a - b;
	if(ans < box) ans = box;
	
	box = a * b;
	if(ans < box) ans = box;
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
ab = [list(map(int,input().split())) for i in range(N-1)]

adj = [[]for i in range(N+1)]
for i in range(N-1):
    a,b = ab[i]
    adj[a].append(b)
    adj[b].append(a)


from collections import deque 
#スタック
s = deque([])

cost = [10**10]*(N+1)

s.append([1,0])
while len(s)>0:
    place,time = s.pop()
    if time > cost[place]:
        continue
    cost[place]=time
    for i in adj[place]:
        if time < cost[i]:
            s.append([i,time+1])

#たどる
root = [N]
nowp = N
nowt = cost[N]
while nowt>0:
    for i in adj[nowp]:
        if cost[i]==nowt-1:
            root.append(i)
            nowp=i
            nowt=nowt-1
            break

feneaba = len(root)//2-1
l,r = min(root[feneaba],root[feneaba+1]),max(root[feneaba],root[feneaba+1])

#Union Find
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size,子なら親の頂点
par = [-1]*(N+1)

for i in range(N-1):
    a,b = ab[i]
    a,b = min(a,b),max(a,b)
    if a==l and b==r:
        continue
    unite(a,b)

print("Fennec" if size(1)>size(N) else "Snuke")

Measured memory_bytes: 109420
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

using namespace std;
using ll = long long;
using vel = vector<ll>;
using ves = vector<string>;
using veb = vector<bool>;
using qul = queue<ll>;

int binary_search(ll x, vel a) {
    auto ite = lower_bound(ALL(a), x);
    if(ite != a.end() && *ite == x) {
        return ite - a.begin();
    } else {
        return -1;
    }
}

ll modpow(ll a, ll n, ll mod) {
    if(n == 0)
        return 1;
    if(n == 1)
        return a % mod;
    if(n % 2 == 1)
        return (a * modpow(a, n - 1, mod)) % mod;
    ll t = modpow(a, n / 2, mod);
    return (t * t) % mod;
}

int main() {
    ll a;
    cin >> a;
    cout << a + (a * a) + (a * a * a) << endl;
}

Measured memory_bytes: 3632
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_DAM_MAX		100000									// 最大ダム数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1DWat[D_DAM_MAX];									// 水量[ダム]
static int si1MWat[D_DAM_MAX];									// 水量[山]
static int siDCnt;												// ダム数
static char sc1Out[D_DAM_MAX * 20];								// 出力内容

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 水量[山] - セット
int
fSetMWat(
	int piWat					// <I> 水量
)
{
	int i;

	// セット
	si1MWat[0] = 0;
	int liWat = piWat;
	for (i = 0; i < siDCnt; i++) {
		si1MWat[i] += liWat;
		si1MWat[i + 1] = si1DWat[i] - liWat;
		liWat = si1MWat[i + 1];
	}

	// 最終水量
	if (si1MWat[0] < si1MWat[siDCnt]) {
		return -1;
	}
	else if (si1MWat[0] > si1MWat[siDCnt]) {
		return 1;
	}

	// 山１
	si1MWat[0] += si1MWat[siDCnt];

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, liRet;
	char lc1Buf[1024];

	// ダム数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siDCnt);

	// 水量 - 取得
	for (i = 0; i < siDCnt; i++) {
		fscanf(szpFpI, "%d", &si1DWat[i]);
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 水量範囲
	int liMin = 0;
	int liMax = si1DWat[0];
	while (1) {

		// 水量
		int liWat = (liMin + liMax) / 2;
		liRet = fSetMWat(liWat);
		if (liRet < 0) {
			if (liMin < liWat) {
				liMin = liWat;
			}
			else {
				liMin++;
			}
		}
		else if (liRet > 0) {
			liMax = liWat;
		}
		else {
			break;
		}
	}

	// 出力内容 - セット
	sprintf(sc1Out, "%d", si1MWat[0]);
	char *lcpPos = sc1Out + strlen(sc1Out);
	for (i = 1; i < siDCnt; i++) {
		sprintf(lc1Buf, " %d", si1MWat[i]);
		int liLen = strlen(lc1Buf);
		memcpy(lcpPos, lc1Buf, liLen);
		lcpPos += liLen;
	}
	lcpPos[0] = '\n';
	lcpPos[1] = '\0';

	// 出力
	fOut(sc1Out);

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 3072
import numpy, itertools

N = int(input())
points = []

for _ in range(N):
    p = list(map(int, input().split()))
    points.append(p)

total = 0
for p1, p2 in itertools.combinations(points,2):
    q1 = numpy.array(p1)
    q2 = numpy.array(p2)
    total += numpy.linalg.norm(q1 - q2)

print(total * 2.0 / N)

Measured memory_bytes: 12504
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll A, B, M;
    cin >> A >> B >> M;
    vec a(A);
    vec b(B);
    Rep (i, A) cin >> a[i];
    Rep (i, B) cin >> b[i];

    ll tmp = inf;
    while (M--) {
        ll x, y, c;
        cin >> x >> y >> c;
        x--;
        y--;
        chmin(tmp, a[x] + b[y] - c);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    chmin(tmp, a[0] + b[0]);

    cout << tmp << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
	int n, k, cnt;
	double ans;
	cin >> n >> k;

	for(int i=1; i<=n; i++){
		if(i >= k){
			ans += 1/((double) n);
			continue;
		}
		for(cnt=1;i*pow(2, cnt) < k;cnt++);
		ans += ( 1/((double) n) ) * pow(0.5, cnt);
	}
	cout << setprecision(12);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,n = LI()
    if b <= n+1:
        print((a*(b-1))//b)
        return
    print((a*n)//b-a*(n//b))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 65588
#include <iostream>
using namespace std;
int main() {
	int a, b, c, x, ans = 0;
	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (i * 500 + j * 100 + k * 50 == x) ans++;
			}
		}
	}
	cout << ans << endl;
}

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++)
typedef long long ll;

int main(){
    ll n,m,ans=0;
    cin >> n >> m;
    priority_queue<ll> q;
    
    for(ll i=0;i<n;i++){
        ll a;
        cin >> a;
        q.push(a);
    }
    
    while(m>0){
        ll now=q.top();
        q.pop();
        now/=2;
        m--;
        q.push(now);
    }
    
    while(!q.empty()){
        ll now=q.top();
        ans+=now;
        q.pop();
    }
    
    cout << ans << endl;
    
    return 0;
}







Measured memory_bytes: 1400
#include <stdio.h>

char calc(short r, short byte) {
    short i;
    char sum = 0;

    for (i=0;i<r;i++) {
        if (!((byte >> i) & 1)) {
            sum += 1;
        }
    }

    if (sum < r - sum) sum = r - sum;

    return sum;
}

int main() {
    while (1) {
        short i;
        int r, c;
        short stats[10000];
        int max_sum = 0;

        scanf("%d %d", &r, &c);
        if (r == 0 && c == 0) return 0;

        for (i=0;i<c;i++) {
            stats[i] = 0;
        }

        for (i=0;i<r;i++) {
            short j;
            for (j=0;j<c;j++) {
                short k;
                scanf("%hd", &k);
                stats[j] += (k << i);
            }
        }

        for (i=0;i<(2<<r)+1;i++) {
            short j;
            int sum = 0;

            for (j=0;j<c;j++) {
                sum += calc(r, i ^ stats[j]);
            }

            if (max_sum < sum) max_sum = sum;
        }

        printf("%d\n", max_sum);
    }
}

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

int main(int argc, char const* argv[])
{
    int a,b;cin>>a>>b;
    if(a<=0 && b >= 0){cout << "Zero\n";return 0;}
    if(b<0 && (b-a) % 2 == 0){cout <<"Negative\n";return 0;}
    cout<<"Positive\n";
    return 0;
}

Measured memory_bytes: 1144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {
	public static String rLine = "";
	public static Integer Weigth = 0;
	public static Integer ItemNum = 0;
	public static HashMap<Integer, Integer> ItemWeigths = new HashMap<Integer,Integer>();
	public static HashMap<Integer, Integer> ItemValues = new HashMap<Integer,Integer>();
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int caseCount = 1;
		
		while(!(rLine = in.readLine()).equals("0"))
		{
			if (!rLine.isEmpty()) 
			{
	
				Weigth = Integer.parseInt(rLine);
				
				ItemNum = Integer.parseInt(in.readLine());
				
				for(int i=0;i<ItemNum;i++){
					String[] str=in.readLine().split(",");
					ItemValues.put(i, Integer.parseInt(str[0]));
					ItemWeigths.put(i, Integer.parseInt(str[1]));
				}
				
				pickup(caseCount);
				caseCount ++;
				ItemWeigths.clear();
				ItemWeigths.clear();
			}
		}
		

	}
	
//	private static int knapsack(int indx, int W) {
//	    if (indx < 0) {
//	        return 0;
//	    }
//	    if (ItemWeigths.get(indx) > W) {
//	        return knapsack(indx-1, W);
//	    } else {
//	        return Math.max(knapsack(indx-1, W), knapsack(indx-1, W - ItemWeigths.get(indx)) + ItemValues.get(indx));
//	    }
//	}

	
	private static void pickup(int count){
		int[][] SelectionTable = new int[ItemNum+1][Weigth+1];
		
		int minWeight=0;
		
		for(int i=0;i <= Weigth; i++){
			SelectionTable[ItemNum][i]=0;
		}
		
		for(int i=ItemNum-1; i>=0; i--){
			for(int j=0; j <= Weigth; j++){
				if(j<ItemWeigths.get(i)){
					SelectionTable[i][j]=SelectionTable[i+1][j];
				}
				else{
					SelectionTable[i][j]=Math.max(SelectionTable[i+1][j],SelectionTable[i+1][j-ItemWeigths.get(i)]+ItemValues.get(i));
					if(0 < j && SelectionTable[i][j] != SelectionTable[i][j-1]){
						minWeight = j;
					}
				}
			}
		}
		
		System.out.printf("Case %d:\n", count);
		System.out.println(SelectionTable[0][Weigth]);
		System.out.println(minWeight);
	}

}

Measured memory_bytes: 62868
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int K; string S; cin >> K >> S;

    if (S.size() <= K) cout << S << endl;
    else
    {
        cout << S.substr(0, K) << "..." << endl;
    }

    return 0;
}


Measured memory_bytes: 3644
k = int(input())
n= 50
lastli = list(range(n))

syo = k//n
amari = k%n

for i in range(len(lastli)):
    lastli[i] += syo

for i in range(amari):
    lastli[i] += n
    for j in range(n):
        if j == i:
            continue
        else:
            lastli[j] -= 1

print(n)
print(*lastli)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    char c;
    cin >> c;
    if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
    {
        cout << "vowel\n";
    }
    else
    {
        cout << "consonant\n";
    }
    
    return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  u32 n, k;
  cin >> n >> k;

  vector<i32> h;
  rep(i, n) {
    i32 hi;
    cin >> hi;
    h.push_back(hi);
  }

  vector<u32> dp(n, UINT32_MAX);

  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < k + 1; j++) {
      if (i - j >= 0) {
        dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]));
      }
    }
  }

  cout << dp[n - 1];

  return 0;
}


Measured memory_bytes: 4028
import copy
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
for i in range(M):
  P, x = map(int, input().split())
  Ts_2 = copy.copy(Ts) #コピーを行う
  Ts_2[P-1] = x
  print(sum(Ts_2))
  

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

int main() {
  int a,b,c,d,e,f,g;
  cin >> a;
  b = a ;
  c = a/100;
  d = b - c*100;
  e = d;
  f = d/10;
  g = e - f*10;
  cout << c + f + g << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //setprecision()
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

double Mcos(double k){return cos(k*atan(1.0)*4/180);}

void monmo(){
    
}

int main() {
    int n;
    int a;
    int c=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a;
        if(i%2==0)continue;
        if(a%2==1)c++;
    }
    cout<<c;
}


Measured memory_bytes: 3672
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

A = list(map(lambda x: x-min(a), a))
B = list(map(lambda x: x-min(b), b))
C = list(map(lambda x: x-min(c), c))

A.sort()
B.sort()
C.sort()

if A==B==C:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

const int MAX_K = 100100;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<vector<mint>> dp(N+10, vector<mint>(MAX_K));
    // dp[0][0] = 1;
    rep(i, MAX_K) dp[0][i] = 1;
    rep(i, N){
        vector<mint> dp2(MAX_K);
        rep(j, K+10){
            dp2[j+1] = dp2[j] + dp[i][j];
            dp[i+1][j] = dp2[j+1] - dp2[max(0, j-A[i])];
        }
    }
    if(K == 0){
        cout << 1 << endl;
    }else{
        cout << (dp[N][K] - dp[N][K-1]).x << endl;
    }
    return 0;
}


Measured memory_bytes: 90264
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s.find('A') != std::string::npos){
        if(s.find('B') != std::string::npos){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
//tanzim bin nasir
#include<bits/stdc++.h>
typedef long long ll;
#define ff first
#define ss second
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
int gcd(int a,int b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
int a[1005];
int main()
{
    int n;
    ll ans=0;
    cin>>n;
    for(int i=1;i*i<n;i++)
    {
      ll temp=n/i;
      if(n%i==0)
      --temp;
      ans=ans+(temp-i)*2+1;//cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int a[110][110]; int b[110]; int c[110];
int main() {
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			c[i] += a[i][j] * b[j];
		}
	}
	for (int i = 0; i < n; i++) {
		cout << c[i] << endl;
	}
}


Measured memory_bytes: 3128
"""
不変なもの
- 移動した行/列内の順番
○ AとBの差によって、線対称(対角線上)のものが決まる
"""
n = int(input())
fs = []
for i in range(n):
    rs = list(input())
    fs.append(rs)
cnt = 0
for a in range(n):
    flg = True
    tmp = []
    for r in fs:
        r_ = r[a:] + r[:a]
        tmp.append(r_)
    for i in range(n):
        for j in range(n):
            flg &= tmp[i][j] == tmp[j][i]
    
    cnt += flg
print(cnt*n)

Measured memory_bytes: 110476
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
	ll n;
	ll sum=0;
	ll m[100010];
	FOR(i,100010){
		m[i]=0;
	}
	cin >> n;
	ll a[100010];
	FOR(i,n){
		cin >> a[i];
		m[a[i]]++;
		sum+=a[i];
	}
	ll q;
	cin >> q;
	ll b[100010],c[100010];
	FOR(i,q){
		cin >> b[i] >> c[i];
		sum+=m[b[i]]*c[i];
		sum-=m[b[i]]*b[i];
		m[c[i]]+=m[b[i]];
		m[b[i]]=0;

		cout << sum << endl;
	}
	
}

Measured memory_bytes: 6772
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;
	int d, x; cin >> d >> x;

	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		int t = 1;
		x++;
		while (t + a <= d) {
			x++;
			t += a;
		}
	}

	cout << x << endl;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=3e5+100;
ll cnt[100];
ll mod=1e9+7;
int32_t main(){
    ll n;
    cin >> n;
    for (int i=0;i<n;i++){
        ll x;
        cin >> x;
        for (int j=0;j<=61;j++){
            if ((x & ((ll)1<<j))!=0){
                cnt[j]++;
            }
        }
    }
    ll ans=0;
    for (int i=0;i<=62;i++){
        ans+=((cnt[i]*(n-cnt[i]))%mod)*(((ll)1<<i)%mod)%mod;
        ans%=mod;
      //  cout << i << " " << cnt[i] << " " << cnt[i] << " " << cnt[i]*(n-cnt[i])*(1<<i) << endl;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int ans = -1;
    int mi = 1000000000;
    for (int i = 0; i < n; ++i) {
        int c, t;
        cin >> c >> t;
        if(t <= m && c < mi){
            mi = c;
            ans = i + 1;
        }
    }
    if (ans == -1) {
        cout << "TLE";
    } else {
        cout << mi;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n;
    cin >> n;
    ll l[n];
    for(int i = 0; i < n; i++)
        cin >> l[i];
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = j + 1; k < n; k++){
                if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i]){
                    if(abs(l[i] - l[j]) < l[k] && l[k] < l[i] + l[j])
                        ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int main(){
  int N; cin >> N;
  vector<int> a(N + 1), b(N + 1), c(N + 1);
  for(int i = 1; i <= N; i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  vector<vector<int>> dp(1000000, vector<int> (4));
  dp[1][1] = a[1]; dp[1][2] = b[1]; dp[1][3] = c[1];
  for(int i = 2; i <= N; i++){
    dp[i][1] = max(dp[i-1][2] + a[i], dp[i-1][3] + a[i]);
    dp[i][2] = max(dp[i-1][1] + b[i], dp[i-1][3] + b[i]);
    dp[i][3] = max(dp[i-1][1] + c[i], dp[i-1][2] + c[i]);
  }
  cout << max(max(dp[N][1], dp[N][2]), dp[N][3]) << endl;
}

Measured memory_bytes: 56064
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = B / A;
		if (D < C)
			System.out.println(D);
		else
			System.out.println(C);
	}

}


Measured memory_bytes: 21844
n=int(input())
a=list(input().split())
o=[]
e=[]
if n==1:
    print(a[0])
elif n%2==0:
    for i in range(1,n,2):
        e.append(a[i])
    for i in range(0,n,2):
        o.append(a[i])
    e.reverse()
    print(" ".join(e)+" "+" ".join(o))
else:
    x=a[0]
    for i in range(1,n,2):
        e.append(a[i])
    for i in range(2,n,2):
        o.append(a[i])
    o.reverse()
    print(" ".join(o)+" "+x+" "+" ".join(e))

Measured memory_bytes: 25504
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(n), c(m), d(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < n; i++) {
    int mind = abs(a[i] - c[0]) + abs(b[i] - d[0]);
    int minp = 0;
    for (int j = 1; j < m; j++) {
      if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < mind) {
        mind = abs(a[i] - c[j]) + abs(b[i] - d[j]);
        minp = j;
      }
    }
    cout << minp + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int i,j;
  int num=0;
  char c[26];
  char moji;

  scanf("%s",c);


  for(i=0;c[i]!='\0';i++)
    num++;

  for(i=0;i<num;i++){
    moji=c[i];
    for(j=i+1;j<num;j++){
      if(moji==c[j]){
	printf("no\n");
      return 0;
      }
    }
  }
  
  printf("yes\n");

  return 0;
}


Measured memory_bytes: 128
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[1]=='9'||s[0]=='9'){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 256
import itertools

n = int(input())

M = 0
A = 0
R = 0
C = 0
H = 0

for i in range(n):
    s = list(input())
    if s[0] == 'M':
        M += 1
    elif s[0] == 'A':
        A += 1
    elif s[0] == 'R':
        R += 1
    elif s[0] == 'C':
        C += 1
    elif s[0] == 'H':
        H += 1

memo = [M,A,R,C,H]

ans = 0

for v in itertools.combinations(memo, 3):
    tmp = 1
    for vv in v:
        tmp *= vv
    ans += tmp
print(ans)

Measured memory_bytes: 91736
L = input()
N = len(L)
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 3
for i in range(1,N):
    dp[i+1] = dp[i] + (dp[i]-2)*2
    dp[i+1] %= (10 ** 9 + 7)
cnt = N-1
one_cnt = 2
ans = dp[N]
for c in L[1:]:
    if c == '1':
        ans += (dp[cnt]-1) * one_cnt
        one_cnt *= 2
        
        ans %= (10 ** 9 + 7)
        one_cnt %= (10 ** 9 + 7)
    cnt -= 1
print(ans)

Measured memory_bytes: 45168
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    int a[5];
    rep(i, 5){
        cin >> a[i];
        if(a[i] == 0){
            cout << i+1 << endl;
            return 0;
        }
    }



    system("pause");
}

Measured memory_bytes: 3588
from fractions import gcd
from functools import reduce

# 最小公倍数を求める
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

BASE = 10**9 + 7

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

num = lcm(A)
ans = 0
for i in range(N):
    ans += num // A[i]
    # ans %= BASE

print(ans%BASE)

Measured memory_bytes: 6136
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;


int main(){
  int count[110];

  for(int i=0;i<110;i++) count[i]=0;
  
  vector<int> V;
  int N;
  cin>>N;

  if(N<=3){
    cout<<0<<endl;
    return 0;
  }

  V.push_back(2); V.push_back(3);
  count[2]++; count[3]++;
  
  for(int i=4;i<=N;i++){
    int temp=i;
    
    for(int j=0;j<(int)V.size();j++){
      while(temp%V[j]==0){
        count[V[j]]++;
        temp/=V[j];
      }
    }
    if(temp!=1){
      count[temp]++;
      V.push_back(temp);  
    } 
  }
  int count74=0,count24=0,count14=0,count4=0,count2=0;

  for(int i=0;i<110;i++){
    if(count[i]>=74) count74++;
    if(count[i]>=24) count24++;
    if(count[i]>=14) count14++;
    if(count[i]>=4) count4++;
    //cout<<i<<" "<<count[i]<<endl;
    if(count[i]>=2) count2++;
  }

  ll ans=count74+count24*(count2-1)+count14*(count4-1)+count4*(count4-1)*(count2-2)/2;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())

MOD = 10 ** 9 + 7

spl = int(N ** 0.5) + 1
l = list(range(spl)) + [N // i for i in reversed(range(1, spl))]
m = 2 * spl - 1

for i in reversed(range(m - 1)):
    l[i + 1] -= l[i]

dp = [l[:]] + [[0] * m for _ in range(K - 1)]
for i in range(K - 1):
    for j in range(m - 1):
        dp[i][j + 1] += dp[i][j]
        dp[i][j + 1] %= MOD

    for j in range(1, m):
        dp[i + 1][-j] = dp[i][j] * l[-j] % MOD

ans = 0
for v in dp[-1][1:]:
    ans += v
    ans %= MOD
print(ans)





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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n, s= 0;
    cin>> n;

    if(n<=2)
    {
        cout << 4<< '\n';
        return 0;
    }

    while (n>1)
    {
        n= (n&1? (n*3)+1 : n/2);
        s++;
    }


    cout << s+2;
    nl;

    return 0;
}




Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var N = input[0];
            var K = input[1];

            Console.WriteLine(N % K == 0 ? 0 : 1);
        }
    }
}

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

using namespace std;
typedef long long ll;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	string a, b; cin >> a >> b;
  	int r = 0;
  	for (int i = 0; i < a.size(); i++) {
        r += (a[i] != b[i]);
    }
  	cout << r << endl;
    return 0;
}


Measured memory_bytes: 3776
import sys
n = int(input())
s = int(input())
def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b

if s == n:
    print(n+1)
    sys.exit(0)
if n < s:
    print(-1)
    sys.exit(0)
     
ans = None
for i in range(2, n):
    if i * i > n:
        break
    if f(i, n) == s:
        ans = i
        break

for i in range(1, n):
    if i * i > n:
        break
    if (n - s) % i == 0:
        b = (n - s) // i + 1
        if f(b, n) == s:
            if ans is None:
                ans = (n - s) // i + 1
            else:
                ans = min((ans, (n - s) // i + 1))

if ans is None:
    print(-1)
else:
    print(ans)


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

int n, a, s1, s2, i;
int main()
{
	cin >> n;
	for (i =0; i < n; i++) {
		scanf ("%d", &a);
		if (a % 4 == 0) s1++;
		else if (a % 2 == 1) s2++;
	}
	if (s1 >= s2 || s1 == s2 - 1 && s1 + s2 == n) cout << "Yes";
	else cout << "No";
    return 0;
}

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

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

  if (N.back() == '2' || N.back() == '4' || N.back() == '5' || N.back() == '7' || N.back() == '9') {
    cout << "hon" << endl;
  }
  else if (N.back() == '0' || N.back() == '1' || N.back() == '6' || N.back() == '8') {
    cout << "pon" << endl;
  }
  else {
    cout << "bon" << endl;
  }
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
typedef struct E{
  int T;
  long int C;
  struct E *N;
}e;
e *l[100001];
long int d[100001];
void df(long int i,long int c){
  d[i]=c;
  e *t=l[i];
  while(t!=NULL){
    if(d[t->T]<0)df(t->T,c+t->C);
    t=t->N;
  }
}
int main(){
  int n,k,x,y,z,q,i;
  e *t;
  scanf("%d",&n);
  for(i=0;i<=n;i++){l[i]=NULL;d[i]=-1;}
  for(i=1;i<n;i++){
    scanf("%d%d%d",&x,&y,&z);
    t=malloc(sizeof(t));t->T=y;t->C=z;t->N=l[x];l[x]=t;
    t=malloc(sizeof(t));t->T=x;t->C=z;t->N=l[y];l[y]=t;
  }
  scanf("%d%d",&q,&k);
  df(k,0);
  for(i=0;i<q;i++){scanf("%d%d",&x,&y);printf("%ld\n",d[x]+d[y]);}
}


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

#define fo(i,n) for (int i = 0; i < n; ++i)
#define tr(i,n) for(auto i=n.begin();i!=n.end();i++)
#define w(t) while(t--)
#define ll long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fst ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
const ll mod = 1000000007;
void solve()
{
    long long int n;
    cin>>n;
    unsigned long long int arr[n],summ[n];
    fo(i,n)
        cin>>arr[i];
    for(int i=n-1;i>=1;i--)
    {
        if(i==n-1)
        {
            summ[i]=arr[i];
        }
        else
        {
            summ[i]=(summ[i+1]+arr[i])%mod;
        }
    }
    long long int ans=0;
    for(int i=0;i<n-1;i++)
    {
        ans+=((arr[i]*summ[i+1])%mod);
        ans=ans%mod;
    }

    cout<<ans%mod;

}

int main()
{
    fst;
    solve();
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 
// ========================================================
signed main(){
  #ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  #endif
  fio;
    int n,m,total=0,cnt = 0;
    cin>>n>>m;
    vector<int> votes(n);
    for(auto &x : votes) {
        cin>>x;
        total += x;
    }

    float lim = (total*0.25)/m;
    sort(all(votes),greater<int>());
    cout<<(votes[m-1] >= lim ?"Yes":"No")<<endl;

  rr;
}



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

/// Constant:
#define         eps         10e-9
#define         pi          2*acos(0)
#define         P1          1e9+7
#define         P2          1e9+9
#define         lli         long long int
/// Loop:
#define         f1(a,b)     for (int i=a; i<=b; i++)
#define         f2(a,b)     for (int j=a; j<=b; j++)
#define         f-1(a,b)     for (int i=b; i>=a; i--)
#define         f-2(a,b)     for (int j=b; j>=a; j--)
///Print:
#define         pY          cout<<"YES"<<endl;
#define         pN          cout<<"NO"<<endl;
#define         py          cout<<"Yes"<<endl;
#define         pn          cout<<"No"<<endl;

using namespace std;
///ISNNJB

/// Functions:
//lli bigmod(lli b, lli p, lli m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ lli res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//lli mod_inverse(lli a, lli mod) { return bigmod(a,mod-2,mod); }
//lli LCM(lli a, lli b){ return a*b/ __gcd(a,b);}

///Global Variable:
int ara[300005],brr[100004];
lli divisor[10000000];
vector<int>di;

void findDivisors(lli n) {
    memset(divisor, 0, sizeof (divisor));

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j * i <= n; j++) {
            divisor[i * j]++;
        }
    }
}

/**int fx[]={+1,-1,+0,+0};
int fy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};*/

int main() {

    /**freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    lli a,b,c,d,t,n,m,x,y,q,ctn=0,l1,l2,total=0;
    cin>>n;
    findDivisors(n);

    for (int i=1; i<=n; i++) {
        total+=(divisor[i]*i);
    }
    cout<<total<<endl;

    return 0;
}



Measured memory_bytes: 81780
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include<list>
#include<map>
#include<utility>
#include<tuple>
#include<numeric>
#include<set>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),a.end()
using namespace std;

int main()
{
	int a, b;
	cin>> a >> b;
	vector <char> s;

	rep(i, a + b + 1) {
		char x;
		cin >> x;
		s.push_back(x);
	}
	bool j = true;
	rep(i, a) {
		if (s[i] <= '9' && s[i] >= '0')continue;
		else  j = false; 
		break;
	}
	if (s[a] != '-') j = false; 
	for (int i = a + 1;i < a + b + 1;i++) {
		if (s[i] <= '9' && s[i] >= '0')continue;
		else j = false; 
		break;
	}
	if (j)cout << "Yes" << endl;
	else cout << "No" << endl;
}



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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    string line;
    getline(cin, line);
        
    int l = line.length();
    int changes = 0;

    for (int i = 0; i < l/2; i++) {
        char c1 = line[i];
        char c2 = line[l - i - 1]; 
        if (c1 != c2) {
            changes++;
        }
    }

    cout << changes;
    
} 




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[200005];
int main(){
	cin>>n; 
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	int x=a[0];
	for(int i=1;i<n;++i){
		x^=a[i];
	}
	for(int i=0;i<n;++i){
		int v=x^a[i];
		cout<<v<<' ';
	}
	cout<<'\n';
	return 0;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

const int MX = (80 + 80) * (80);
int dp[81][81][MX];

void solve() {
  int h, w;
  cin >> h >> w;
  vvi mp(h + 1, vi(w + 1));
  rep(i, h) rep(j, w) {
    int a;
    cin >> a;
    mp[i][j] += a;
  }
  rep(i, h) rep(j, w) {
    int b;
    cin >> b;
    mp[i][j] -= b;
  }
  dumpv(mp, h, w);
  dp[0][0][abs(mp[0][0])] = 1;
  rep(i, h) rep(j, w) {
    rep(k, MX) {
      if (dp[i][j][k]) {
        dp[i][j + 1][abs(k - mp[i][j + 1])] = 1;
        dp[i][j + 1][abs(k + mp[i][j + 1])] = 1;
        dp[i + 1][j][abs(k - mp[i + 1][j])] = 1;
        dp[i + 1][j][abs(k + mp[i + 1][j])] = 1;
      }
    }
  }
  int mn = INF;
  rep(k, MX) {
    if (dp[h - 1][w - 1][k]) mins(mn, k);
  }
  cout << mn << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

using namespace std;

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

const int INF = 1000000000; //
const ll LINF = (ll) 4000000000000000000; //
const ll MOD = (ll) 1000000007; //
const double PI = acos(-1.0); //

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())

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

int main() {
    set<int> primes;

    REP(i, 2, 100010) {
        auto itr = primes.begin();
        bool p_is = true;
        while (itr != primes.end()) {
            if (i % *itr == 0) {
                p_is = false;
                break;
            }
            itr++;
        }
        if (p_is) primes.insert(i);
    }

    int csum[100010];
    csum[1] = 0;

    REP(i, 3, 100010) {
        if (i % 2 == 0) continue;
        if (primes.count(i) && primes.count((i + 1) / 2)) csum[i] = csum[i - 2] + 1;
        else csum[i] = csum[i - 2];
    }

    int q;
    cin >> q;

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        if (l == 1) cout << csum[r] << endl;
        else cout << csum[r] - csum[l - 2] << endl;
    }

    return 0;
}


Measured memory_bytes: 1536
import math
abc=list(map(int,input().split()))
a=abc[0]
b=abc[1]
c=math.radians(abc[2])

s=1/2*a*b*math.sin(c)
l=math.sqrt(pow(a,2)+pow(b,2)-2*a*b*math.cos(c))
L=a+b+l
h=b*math.sin(c)

print(s)
print(L)
print(h)




Measured memory_bytes: 5712
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;

  char ch = s[0];
  int l = 0, r = 0, crr = 0;
  for ( int i = 1; i < n; i++){
    if( s[i] != ch){
      if ( s[i] == 'L')l++;
      if ( s[i] == 'R')r++;
      ch = s[i];
    } else {
      crr++;
    }
    if ( i == n-1){
      if ( s[i] == 'L')l--;
      if ( s[i] == 'R')r--;
    }
  }

  if ( k <= max(l,r)){
    cout << min(crr + 2*k, n-1) << endl;
  } else {
    cout << min(crr + 2*max(l,r) + k - max(l,r), n-1) << endl;
  }

  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
char in[5];
int main(){
	scanf("%s",in);
	for(int i=0;i<3;i++){
		if(in[i]=='1')in[i]='9';
		else in[i]='1';
	}
	printf("%s\n",in);
}

Measured memory_bytes: 128
def d_even_relation_bfs():
    from collections import deque
    N = int(input())
    Edges = [[int(i) for i in input().split()] for j in range(N - 1)]

    graph = [[] for _ in range(N)]
    for u, v, w in Edges:  # 頂点は 0-indexed とする
        graph[u - 1].append((v - 1, w))
        graph[v - 1].append((u - 1, w))
    distance_from_root = [0] * N  # 根は頂点 0 とする

    queue = deque([(-1, 0, 0)])  # 親と現在の頂点番号，根から親までの距離
    while queue:
        parent, current, distance = queue.pop()
        distance_from_root[current] = distance
        for next_vertex, dist in graph[current]:
            if parent != next_vertex:  # 木を「逆戻り」しない頂点だけ調べる
                queue.appendleft((current, next_vertex, distance + dist))
    ans = (1 if d % 2 == 0 else 0 for d in distance_from_root)
    return ' '.join(map(str, ans))

print(d_even_relation_bfs())

Measured memory_bytes: 67068