akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
*/
/*#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx")*/

using namespace std;
// using namespace __gnu_pbds;

#define ABS(x) ((x) < 0 ? -(x) : (x))
#define ld double
#define ll long long
#define uint unsigned int
#define all(a) a.begin(), a.end()
#ifdef DEBUG
    #define NAME "1"
#else
    #define NAME "a"
#endif
#define FREOPEN freopen(NAME".in", "r", stdin); freopen(NAME".out", "w", stdout)
#define PI 3.1415926535897932384626433832795

const int N = 3 * 1e5 + 3, M = 1e4 + 6, MODM = 1e9 + 7;

// mt19937 gen{random_device()()};

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll n;
    cin >> n;
    b = min(b, 2 * a);
    c = min(c, 2 * b);
    d = min(d, 2 * c);
    cout << n / 2 * d + (n & 1) * c;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
import fractions


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


def main():
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    C_D_lcm = lcm(C, D)

    z = B//C_D_lcm - A//C_D_lcm

    if A % C == 0:
        x = (B//C)+1 - (A//C)
    else:
        x = (B//C) - A//C

    y = B//D - A//D

    print((B-A+1)-(x+y-z))


if __name__ == "__main__":
    main()


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

using namespace std;
#define int long long
int MOD = 1000000007;

signed main(){
    int N;
    cin >> N;
    
    int a;
    int cnt = 0;
    for(int i=0;i<N;i++){
        cin >> a;
        while(a%2==0){
            a = a/2;
            cnt++;
        }
    }
    
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

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<long long> VL;
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 (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
// #define dump(x) cerr << #x << " = " << (x) << endl;
// #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
//                       << " " << __FILE__ << endl;

int main()
{
    string weather;

    cin >> weather;

    if (weather == "Sunny")
    {
        cout << "Cloudy" << endl;
    }
    else if (weather == "Cloudy")
    {
        cout << "Rainy" << endl;
    }
    else if (weather == "Rainy")
    {
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 760
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
fn main() {
    input!{
        n:usize,
        mut s:[chars;n],
    }
    s[0].sort();
    for i in 0..n {
        s[i].sort();
    }
    s.sort();
    // println!("{:?}", s);
    let mut ans:u64 = 0;
    // let mut map = HashMap::new::<Vec<char>, i64>();
    // map[s[0]]+=1;
    let mut count = 1;
    for i in 0..n-1 {
        // println!("{}", count);
        if s[i]==s[i+1] {
            count+=1;
        }else{
            ans+=count * (count - 1) / 2;
            count=1;
        }
    }
    ans+=count * (count - 1) / 2;
    println!("{}",ans);
}

Measured memory_bytes: 14588
#include<iostream>

using namespace std;

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

Measured memory_bytes: 256
import re

S_IN = input()
T = input()
U = 'UNRESTORABLE'

def get_substring(start_index, len, str):
    """
    get substring.
    """
    return str[start_index:start_index + len]

def validate(str, cmp):
    """
    validate.
    """
    is_valid = True
    for index, c in enumerate(str):
        if c == '?':
            continue
        elif c == cmp[index]:
            continue
        else:
            is_valid = False
            break
    return is_valid

def make_string(start_index, replacement, str):
    """
    make string.
    """
    length = len(replacement)
    before = str[:start_index].replace('?', 'a')
    repl = replacement
    after = str[start_index + length:].replace('?', 'a')
    return before + repl + after

def main():
    """
    main function
    """
    s_length = len(S_IN)
    t_length = len(T)
    limit = s_length - t_length + 1

    if limit < 0:
        print(U)

    list = []
    # print("limit - {0}".format(limit))
    for i in range(limit):
        substr = get_substring(i, t_length, S_IN)
        # print(substr)
        if validate(substr, T):
            list.append(make_string(i, T, S_IN))

    list.sort()
    ans = list[0] if bool(list) else U

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;
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; }

using Int = unsigned int;
using llong = long long;
using Llong = unsigned long long;
using ldouble = long double;
using intV = vector<int>;
using llongV = vector<long long>;
using llongVV = vector<vector<long long>>;

template<typename T=llong>
using Graph = vector<vector<T>>;

template<typename T=llong>
struct Edge {
    T from;
    T to;
    T cost;
};

template<typename T=llong>
using asc = less<T>();
template<typename T=llong>
using desc = greater<T>();

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

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

    llong N;
    cin >> N;
    llongV L = llongV(N, 0);
    FOR(i, N) {
        cin >> L[i];
    }

    sort(L.begin(), L.end());
    llong ans = 0;
    FOR(i, N) {
        FOR(j, N) {
            if(i == j) continue;
            llong A = L[i];
            llong B = L[j];

            llong left = upper_bound(L.begin(), L.end(), abs(A- B)) - L.begin();
            llong right = lower_bound(L.begin(), L.end(), A + B) - L.begin();
            ans += right - left;

            if(left <= i && i < right) ans -= 1;
            if(left <= j && j < right) ans -= 1;
        }
    }

    cout << (ans / 6) << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
3 9
2 1
3 1
5 2

output:
27
"""

import sys
from collections import namedtuple


def solve():
    dp = [0] * (real_cp + 1)
    for item in item_list:
        v, w = item.value, item.weight
        for cp in range(w, real_cp + 1):
            dp[cp] = max(dp[cp], dp[cp - w] + v)

    return dp[-1]


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    c_items, real_cp = map(int, _input[0].split())
    items = map(lambda x: x.split(), _input[1:])

    Item = namedtuple('Item', ('value', 'weight'))
    item_list = [Item(int(v), int(w)) for v, w in items]

    print(solve())

Measured memory_bytes: 8256
#include<bits/stdc++.h>
using namespace std;
#define fine cout<<"fine"<<endl;
#define ll long long int
#define pb push_back
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
const ll inf=(ll)2e18;
const int mod=1e9+7;
bool overflow(ll a,ll b){
    if (a <= (inf+b-1)/b) return false;
    return true;
}
int main(){
FASTIO;
int n,m;
cin>>n>>m;
int x=(n*(n-1))/2;
x+=(m*(m-1))/2;
cout<<x<<endl;
}


Measured memory_bytes: 256
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#ifdef LOCAL
#include "prettyprint.hpp"
#else
#define debug(...)
#define debuga(arr, n)
#define debugg(grid, n) 
#endif
typedef long long int ll;
#define int ll
#define F first
#define S second
#define float double
const int inf = LLONG_MAX;
int get() { int x; cin >> x; return x; }
void getl(int* ar, int sz){ for(int i=0; i<sz; i++) cin >> ar[i];}
template <typename T> void print(T x) { cout << x << "\n";}
template <typename T> void prints(T x) { cout << x << " ";}
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int mod = 1e9+7;
const int N = 1e6+1;

int32_t main(){
	fast_io();
	int n; cin >> n;
	vi a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	db ans;
	for (int i = 0; i < n; ++i) {
		ans += 1.0/a[i];
	}
	print(1.0/ans);
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import math

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = map(int, input().split())
    A = [int(i) for i in input().split()]

    dv = []
    for _ in range(60):
        l = [0] * N
        dv.append(l)
    
    for n in range(N):
        dv[0][n] = A[n] - 1
    
    for k in range(1, 60):
        for n in range(N):
            dv[k][n] = dv[k - 1][dv[k - 1][n]]
    
    a = []
    for i in range(60):
        if K>>i & 1:
            a.append(i)

    now = 0
    for i in reversed(a):
        now = dv[i][now]
    print(now + 1)





    pass

if __name__ == '__main__':
    main()


Measured memory_bytes: 174564
#include<stdio.h>

int main()
       
    {
       	int a[10],i,t ,j;
       	for (i=0;i<10;i++)
           	scanf("%d",&a[i]);
       	for (i=1;i<10;i++)	
               for (j=0;j<10-i;j++)
                  if (a[j]<a[j+1])
                  {
                  	t=a[j+1];
                  	a[j+1]=a[j];
                  	a[j]=t;
                  	}
           	for (i=0;i<3;i++)	
                  printf("%d\n", a[i]);      
                    return 0;
      }     

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

int main(void)
{
  int n;
  cin >> n;
  vector<int> data(n);
  vector<int> sort(n);
  int cnt = 0;
  for(int i = 0; i < n ; i++)
  {
    cin >> data[i];
    sort[i] = i + 1;
    if(data[i] != sort[i])
      cnt++;
  }
  if(cnt < 3)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)

using namespace std;

void solve(){
  ll n,k;
  cin >> n >> k;
  set <ll> se;
  for(ll i=1;i<=n;i++){
    ll d;
    cin >> d;
    for(ll i=1;i<=d;i++){
      ll x;
      cin >> x;
      se.insert(x);
    }
  }
  g(n-se.size());
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
 //   cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
      solve();
        
    }
return 0;
}

Measured memory_bytes: 3660
from bisect import bisect_right
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
F = [0 for _ in range(N+1)]
for i in range(N-1,-1,-1):
    b = B[i]
    indC = bisect_right(C,b)
    if i<N-1:
        indC1 = bisect_right(C,B[i+1])
    else:
        indC1 = N
    F[i] = F[i+1]+indC1-indC
G = [0 for _ in range(N+1)]
for i in range(N-1,-1,-1):
    G[i] = G[i+1]+F[i]
cnt = 0
for i in range(N):
    a = A[i]
    indB = bisect_right(B,a)
    cnt += G[indB]
print(cnt)

Measured memory_bytes: 112996
N = int(input())
S = [0, 0, 0, 0]
for i in range(N):
    s = input()
    if s == 'AC': S[0] += 1
    elif s == 'WA': S[1] += 1
    elif s == 'TLE': S[2] += 1
    else: S[3] += 1
print('AC x', S[0])
print('WA x', S[1])
print('TLE x', S[2])
print('RE x', S[3])

Measured memory_bytes: 9208
import sys
input = sys.stdin.buffer.readline

N, X, Y = map(int, input().split())

graph = [[] for _ in range(N + 1)]
for i in range(1, N):
    graph[i].append(i + 1)
    graph[i + 1].append(i)
graph[X].append(Y)
graph[Y].append(X)
#print(graph)

def bfs(st, graph):
    INF = 10 ** 18
    dist = [INF] * len(graph)
    dist[st] = 0
    stack = [st]
    while stack:
        s = stack.pop()
        for t in graph[s]:
            if dist[t] > dist[s] + 1:
                dist[t] = dist[s] + 1
                stack.append(t)
    return dist

answer = [0] * (N + 1)
for i in range(1, N + 1):
    dist = bfs(i, graph)
    #print(dist)
    for j in range(1, N + 1):
        answer[dist[j]] += 1

for i in range(1, N):
    print(answer[i] // 2)

Measured memory_bytes: 46940
H, W = map(int, input().split())
T = [[] for i in range(H)]
for i in range(H):
    a = list(input())
    T[i] = a

U = [[0] * W for j in range(H)]
L = [[0] * W for j in range(H)]
R = [[0] * W for j in range(H)]
D = [[0] * W for j in range(H)]
for i in range(H):
    for j in range(W):
        if i > 0:
            if T[i][j] != "#":
                U[i][j] = U[i - 1][j] + 1
        else:
            U[i][j] = int(T[i][j] != "#")

        if j > 0:
            if T[i][j] != "#":
                L[i][j] = L[i][j - 1] + 1
        else:
            L[i][j] = int(T[i][j] != "#")

for i in range(H - 1, -1, -1):
    for j in range(W - 1, -1, -1):
        if i < H - 1:
            if T[i][j] != "#":
                D[i][j] = D[i + 1][j] + 1
        else:
            D[i][j] = int(T[i][j] != "#")

        if j < W - 1:
            if T[i][j] != "#":
                R[i][j] = R[i][j + 1] + 1
        else:
            R[i][j] = int(T[i][j] != "#")


num = 0
for i in range(H):
    for j in range(W):
        tmp = 0
        if T[i][j] == '.':
            tmp += U[i][j] + D[i][j] + R[i][j] + L[i][j] - 3
        num = max(num, tmp)
print(num)

Measured memory_bytes: 309768
#include<stdio.h>
#include<string.h>
int main()
{
    char ara[10];
    int i,flag=0;
    scanf("%s",ara);
    for(i=0;i<strlen(ara);i++)
    {
        if(ara[i]==ara[i+1])
            flag=1;
    }
    if(flag==1)
        printf("Bad\n");
    else
        printf("Good\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		
		double hour = h / 12  + m / 60 * (360 / 12) / 360;
		double minutes = m / 60;
		
		double angle = hour < minutes ? 360 * (minutes - hour)  : 360 * (hour - minutes);
		double ansSquare = Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(Math.toRadians(angle));
		
		System.out.println(Math.sqrt(ansSquare));
		sc.close();
	}

}

Measured memory_bytes: 37488
import java.io.*;
        import java.math.BigInteger;
        import java.util.Arrays;
        import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int n=sc.nextInt();
        long k=sc.nextLong();
        int a[]=new int[n+100];
        int b=1;
        //System.out.println(n+" "+k);
        for(int i=1;i<=n;i++)
            a[i]=sc.nextInt();
        //System.out.println(k);
        if(k<=200000){
            while(k-->0){
                b=a[b];
            }
        }else{
            boolean m[]=new boolean[n+100];
            m[1]=true;
            int c=1;
            c=a[c];
            //System.out.println("a");
            while (true){
                if(m[a[c]]) {
                    c=a[c];
                    break;
                }
                //System.out.println(c+" "+a[c]);
                c=a[c];
                m[c]=true;
            }
            int count=1;
            int v=a[c];
            while(v!=c){
                v=a[v];
                count++;
            }
            //System.out.println(count);
            b=1;
            while(true){
                b=a[b];
                k--;
                //System.out.println(b);
                if(b==c)
                    break;
            }
            k=k%count;
            while(k-->0){
                b=a[b];
            }
            //System.out.println(count);
        }
        System.out.print(b);
    }
}


Measured memory_bytes: 60304
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int length = s.length();
        for (int i = 0; i < length; i++) {
            System.out.print("x");
        }
        System.out.println();
    }
}


Measured memory_bytes: 22612
#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};
use std::{cmp, fmt};

fn main() {
    let (a, b): (u32, u32) = {
        let mut sc = InputScanOnce::new(io::stdin(), 1024);
        (sc.next(), sc.next())
    };
    if a < 9 && b < 9 {
        println!("Yay!");
    } else {
        println!(":(");
    }
}

struct InputScanOnce {
    buf: Vec<u8>,
    pos: usize,
}

#[allow(dead_code)]
impl InputScanOnce {
    fn new<R: Read>(mut reader: R, estimated: usize) -> Self {
        let mut buf = Vec::with_capacity(estimated);
        let _ = io::copy(&mut reader, &mut buf).unwrap();
        InputScanOnce { buf: buf, pos: 0 }
    }

    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
        T3::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        T::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                let l = self.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            })
            .collect()
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;


// 137_b
public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        String k = scan.next();

        StringBuilder sb = new StringBuilder("");

        for (int i = 0; i < k.length(); i++) {
            sb.append("x");
        }

        out(sb.toString());

    }

    /*
     * 以下メソッド集
     */

    static long gcd(long a, long b) {

        return (b == 0) ? a : gcd(b, a % b);
    }

    static int gcd(int a, int b) {

        return (b == 0) ? a : gcd(b, a % b);
    }

    static void out(String info) {

        System.out.println(info);
    }

    static void out(int info) {

        System.out.println(info);
    }

    static void out(double info) {

        System.out.println(info);
    }

    static void out(long info) {

        System.out.println(info);
    }

}


Measured memory_bytes: 23636
n=int(input())
a=list(map(int,input().split()))
d={}
e={}
c=0

for i in range(n):
    if a[i]+i not in d:
        d[a[i]+i]=1
    else:
        d[a[i]+i]+=1
    if i-a[i] not in e:
        e[i-a[i]]=1
    else:
        e[i-a[i]]+=1
for i in d.keys():
    if i not in e:
        continue
    else:
        c+=d[i]*e[i]  

print(c)

Measured memory_bytes: 139152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=200005;
int n,m;
vector<int> v[max_n];
struct Seg//min 
{
    #define lson l,mid,rt<<1
    #define rson mid+1,r,rt<<1|1
    int d[1<<20],lazy[1<<20];
    void pushup(int rt)
    {
        d[rt]=min(d[rt<<1],d[rt<<1|1]);
    }
    void pushdown(int rt,int ln=1,int rn=1)
    {
        if(lazy[rt])
        {
            d[rt<<1]+=lazy[rt]*ln;
            d[rt<<1|1]+=lazy[rt]*rn;
            lazy[rt<<1]+=lazy[rt];
            lazy[rt<<1|1]+=lazy[rt];
            lazy[rt]=0;
        }
    }
    void init(int l,int r,int rt)
    {
        d[rt]=INT_MAX,lazy[rt]=0;
        if(l==r)return;
        int mid=l+r>>1;
        init(lson),init(rson);
    }
    void ins(int x,int c,int l,int r,int rt)
    {
        if(l==r)
        {
            d[rt]=c;
            return;
        }
        int mid=l+r>>1;
        pushdown(rt);
        if(x<=mid)ins(x,c,lson);
        else ins(x,c,rson);
        pushup(rt);
    }
    void update(int L,int R,int C,int l,int r,int rt)
    {
        if(L>R)return;
        if(l>=L&&r<=R)
        {
            d[rt]+=C;
            lazy[rt]+=C;
            return;
        }
        int mid=l+r>>1;
        pushdown(rt);
        if(mid>=L)update(L,R,C,lson);
        if(mid<R)update(L,R,C,rson);
        pushup(rt);
    }
    int query(int L,int R,int l,int r,int rt)
    {
        if(L>R||L>r||R<l)return INT_MAX;
        if(l>=L&&r<=R)return d[rt];
        int mid=l+r>>1;
        pushdown(rt);
        return min(query(L,R,lson),query(L,R,rson));
    }
}Tree;
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        int l,r;scanf("%d%d",&l,&r);
        v[l].push_back(r);
    }
    Tree.init(1,m+1,1);
    for(int i=1;i<=m+1;i++)Tree.ins(i,-i,1,m+1,1);
    int ans=n-m;
    for(int i=0;i<=m;i++){
        for(auto x:v[i])Tree.update(1,x,-1,1,m+1,1);
        int res=-Tree.query(i+1,m+1,1,m+1,1);
        ans=max(ans,res-i-m-1);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 16768
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
void solve()
{
    int n;
    cin >> n;
    int res = 0;
    for (int i = 2; i < 55556; i++)
    {
        int cnt = 0;
        for (int j = 2; j < i; j++)
        {
            if (i % j == 0)
                cnt++;
        }
        if (cnt == 0 && i % 5 == 1)
        {
            cout << i << endl;
            res++;
            if (res == n)
                break;
        }
    }
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    long long ans = LLONG_MAX;
    for(int i=0; i<2; ++i){
        long long cost = 0;
        long long sum = 0;
        for(int j=0; j<n; ++j){
            sum += a[j];
            if((i + j) % 2 == 0){
                if(sum <= 0){
                    cost += 1 - sum;
                    sum = 1;
                }
            }
            else{
                if(sum >= 0){
                    cost += sum + 1;
                    sum = -1;
                }
            }
        }
        ans = min(ans, cost);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(int argc, char const *argv[]) {
  ll n, a, b;std::cin >> n >> a >> b;
  std::cout << min(a, b) << " " << max(a+b-n, (ll)0) << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

const int N = 54;
int a[N], dp[N][N * N] = {0};

signed main() {
    int n, A;
    cin >> n >> A;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    dp[0][0] = 1;
    for(int i = 1; i <= n; i++) {
        for(int j = i - 1; j >= 0; j--) {
            for(int k = 0; k < N * N; k++) {
                dp[j + 1][a[i] + k] += dp[j][k];
            }
        }
    }
    int ans = 0;
    for(int k = 1; k <= n; k++) {
        ans += dp[k][k * A];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>                                                                         
                                                                                          
using namespace std;                                                                      
                                                                                          
int main()                                                                                
{                                                                                         
  int n, k, r, s, p;                                                                      
  string t;                                                                               
                                                                                          
  cin >> n >> k >> r >> s >> p;                                                           
  cin >> t;                                                                               
                                                                                          
  int score = 0;                                                                          
  string a = t;                                                                           
                                                                                          
  for (int i=0; i<n; i++) {                                                               
    if (i < k) {                                                                          
      if (t[i] == 'r') { a[i] = 'p'; score += p; }                                        
      if (t[i] == 's') { a[i] = 'r'; score += r; }                                        
      if (t[i] == 'p') { a[i] = 's'; score += s; }                                        
    } else {                                                                              
      if (t[i] == 'r') {                                                                  
        if (a[i-k] == 'p') { a[i] = 'n'; } else { a[i] = 'p'; score += p; }               
      } else if (t[i] == 's') {                                                           
        if (a[i-k] == 'r') { a[i] = 'n'; } else { a[i] = 'r'; score += r; }               
      } else if (t[i] == 'p') {                                                           
        if (a[i-k] == 's') { a[i] = 'n'; } else { a[i] = 's'; score += s; }               
      }                                                                                   
    }                                                                                     
  }                                                                                       
                                                                                          
  cout << score << endl;                                                                  
                                                                                          
  return 0;                                                                               
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define pi pair<int, int>
#define ps pair<string, string>
#define pl pair<long, long>
#define pll pair<long long, long long>
#define vll vector<long long>
#define vl vector<long>
#define vi vector<int>
#define vs vector<string>
#define vps vector< ps >
#define vpi vector< pi >
#define vpl vector< pl >
#define vpll vector< pll >
#define flash  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc(t,T) for(long long t=0;t<T;t++)
#define rep(i,s,n,d) for(long long i=s;i<n;i=i+d)

bool sortbysec(const pll &a,
              const pll &b)
{
    return (a.second < b.second);
}

void func(void)
{
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
}
int main(){


    ll n;
    cin>>n;
    ll a[n];
    rep(i,0,n,1)cin>>a[i];
    ll sum1=a[0];
    ll count1=0;
    ll d=0;
    if(a[0]<=0){
        sum1=1;
        count1=count1+abs(a[0]-1);
    }
   rep(i,1,n,1){
       ll sum3=a[i]+sum1;
    if(sum3*sum1>=0){
        if(sum1>0)
        d=-1;
        else d=1;
        count1=count1+abs(sum3-d);
        sum1=d;
    }
    else sum1=sum1+a[i];
   }
   ll sum2=a[0];
   ll count2=0;
   d=0;
     if(a[0]>=0){
        sum2=-1;
        count2=count2+abs(a[0]+1);
    }

   rep(i,1,n,1){
    ll sum3=a[i]+sum2;
    if(sum3*sum2>=0){
        if(sum2>0)
        d=-1;
        else d=1;
        count2=count2+abs(sum3-d);
        sum2=d;
    }
    else sum2=sum2+a[i];
   }
   cout<<min(count1,count2)<<endl;


}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define m 1000000007
#define MAXN 1000001
#define satya ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define cil(a,b) (((a-1)/b)+1)
//#define init int t;cin>>t;while(t--)
#define in(a) ll a;scanf("%lld",&a)
#define ine(a,b) ll a,b;scanf("%lld lld",&a,&b)



ll spf[MAXN]; 

void sieve1() 
{ 
	spf[1] = 1; 
	for (int i=2; i<MAXN; i++) 

		spf[i] = i; 

	for (int i=4; i<MAXN; i+=2) 
		spf[i] = 2; 

	for (int i=3; i*i<MAXN; i++) 
	{ 
		if (spf[i] == i) 
		{ 
			for (int j=i*i; j<MAXN; j+=i) 

				if (spf[j]==j) 
					spf[j] = i; 
		} 
	} 
} 

ll  getFactorization(int x) 
{ 
	vector<int> ret; 
	long long int p=0;
	while (x != 1) 
	{ 
		ret.push_back(spf[x]); 
		x = x / spf[x]; 
	} 
	sort(ret.begin(),ret.end());
	for(int i=0;i<ret.size()-1;i++) 
	{
	    if(ret[i]!=ret[i+1])
	    p=p+ret[i];
	}
	p=p+ret[ret.size()-1];
	return p;
} 

ll d[1000055],u=0;
	bool prime[100001]; 
void Sieve(int n) 
{ 
// 	bool prime[n+1]; 
//	ll u=0;
	memset(prime, true, sizeof(prime)); 

	for (int p=2; p*p<=n; p++) 
	{ 
		if (prime[p] == true) 
		{ 
			for (int i=p*2; i<=n; i += p) 
				prime[i] = false; 
		} 
	} 

	for (int p=2; p<=n; p++) 
	if (prime[p]) 
	{
	    d[u]=p;
	    u++;
	}
} 

ll minverse(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return minverse((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*minverse((x*x)%M,(n-1)/2,M))%M;

}
// ll prime(ll n){
//     ll i;
//     if(n==1||n==0)
//     return 0;
//     for(i=2;i<sqrt(n);i++)
//     {
//         if(n%i==0)
//         return 0;
//     }
//     return 1;
// }
int ftemp(int d)
{
    if(d==1)
    return 1;
   ll  temp=0;
   for(ll i=2;i<=d;i++)
   {
       if(d%i==0){
           if(prime[i]){
       if(d%(i*i)==0)
       {
           return 0;
       }
       temp++;
       }
       }
   }
   if(temp%2==0)
   return 1;
   return -1;
}
int main() {
       satya;
     //sieve1(); 
     Sieve(100000);
     ll p=0;
     ll n,k;
     cin>>n>>k;
     ll a[n],i;
     for(i=0;i<n;i++)
     {
         cin>>a[i];
         if(a[i]>=k)
         p++;
     }
     cout<<p<<endl;
   return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

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

  ll A=0,B=1;
  for(int i=0;i<N;i++){
    ll q,x;
    cin>>q>>x;
    if(q==1){
      B*=x;
      A*=x;
    }else if(q==2) A+=x;
    else A-=x;
  }

  cout<<-A<<" "<<B<<endl;

  return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
 
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define PI acos(-1.0)
const int N=1e5 + 5;
const int M=1e5 + 5;
 
ll d[N],sub[N];
vector <int> g[N]; 
vector < pair < ll , int > > v;
bool vis[N];
ll ans[N],bar[N];
int n;

void dfs(int s)
{
    vis[s]=true;
    for(int i=0;i<g[s].size();i++){
        int x = g[s][i];
        if(!vis[x]){
            dfs(x);
        bar[s]+=bar[x]+sub[x];
        }
    }
}

void dfs1(int s)
{
    vis[s]=true;
    for(int i=0;i<g[s].size();i++){
        int x = g[s][i];
        if(!vis[x]){
            ll ff = ans[s];
            ff -= bar[x]+sub[x];
            ff += n-sub[x]+bar[x];
            ans[x]=ff;
            dfs1(x);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    int i;
    map <ll,int> mp;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>d[i];
        mp[d[i]]=i;
        v.pb(mkp(d[i],i));
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    for(i=1;i<=n;i++){
        sub[i]=1;
    }

    for(i=0;i<n-1;i++){
        int x = v[i].se;
        ll foo = d[x]-((ll)n - 2*sub[x]);
        int y = mp[foo];

        if(y==0){
        //    cout << i << endl;
            cout << -1 << endl;
            return 0;
        }
        sub[y]+=sub[x];

        g[y].pb(x);
        g[x].pb(y);
    }
    int yy = v[n-1].se;
    for(i=1;i<=n;i++){
        vis[i]=false;
    }
    for(i=1;i<=n;i++){
        bar[i]=0;
    }
    dfs(yy);
    for(i=1;i<=n;i++){
        vis[i]=false;
    }
    ans[yy]=bar[yy];
    dfs1(yy);
    //cout << ans[1]<<endl;
    for(i=1;i<=n;i++){
        if(ans[i]!=d[i]){
            cout << -1 << endl;
            return 0;
        }
    }
    for(i=1;i<=n;i++){
        for(int j=0;j<g[i].size();j++){
            int x = g[i][j];
            if(x>i) cout << i << " " << x << endl;
        }
    }


 
    return 0;
}

Measured memory_bytes: 20208
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << 48-n << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//絶対値
long long int change_plus(long long int a) {
	if (a < 0) { return -a; }
	if (a >= 0) { return a; }
}
//大小比較(大)
long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}

//大小比較(小)
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

main() {
	long long int n, m, k = 0;
	char str[5];
	scanf("%lld",&n);

	 printf("ABC%lld",n);
	

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    cout << (n - 1) * n / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n, k;
	cin >> n >> k;
	if ((n + 1) / 2 >= k)
		puts("YES");
	else
		puts("NO");
	return 0;
}

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

const int N_MAX = 10;

struct Team{
	int id;
	int win;
	int lose;
	char t;
};

class TeamSort
{
public:
	bool operator()( const Team& t0, const Team& t1 )
	{
		if( t0.win > t1.win ) return true;
		if( t0.win < t1.win ) return false;
		if( t0.lose < t1.lose ) return true;
		if( t0.lose > t1.lose ) return false;
		return t0.id < t1.id;
	}
};

int main()
{
	int n;
	while( cin >> n && n ){
		vector< Team > team;
		for( int i = 0; i < n; ++i ){
			Team tm;
			memset( &tm, 0, sizeof(tm) );
			tm.id = i;
			cin >> tm.t;
			for( int j = 0; j < n - 1; ++j ){
				int r;
				cin >> r;
				switch( r ){
					case 0: ++tm.win; break;
					case 1: ++tm.lose; break;
				}
			}
			team.push_back( tm );
		}
		sort( team.begin(), team.end(), TeamSort() );
		for( int i = 0; i < n; ++i ){
			cout << team[ i ].t << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1204
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]

cnt = 0
for i in range(h):
    for j in range(w):
        if a[i][j] % 2 == 1:
            cnt += 1

res = []
c = 0
move_flag = False
for i in range(h):
    if i % 2 == 0:
        for j in range(w):
            if a[i][j] % 2 == 1:
                c += 1
                if move_flag:
                    move_flag = False
                else:
                    if cnt % 2 == 0 or c != cnt:
                        move_flag = True
            if move_flag:
                if j < w - 1:
                    res.append([i+1, j+1, i+1, j+2])
                else:
                    res.append([i+1, j+1, i+2, j+1])
    else:
        for j in range(w-1, -1, -1):
            if a[i][j] % 2 == 1:
                c += 1
                if move_flag:
                    move_flag = False
                else:
                    if cnt % 2 == 0 or c != cnt:
                        move_flag = True
            if move_flag:
                if j > 0:
                    res.append([i+1, j+1, i+1, j])
                else:
                    res.append([i+1, j+1, i+2, j+1])

print(len(res))
for y1, x1, y2, x2 in res:
    print(y1, x1, y2, x2)

Measured memory_bytes: 94660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    map<int, int> m;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        m[a]++;
    }
    if(m.size() == 1)
    {
        auto itr = m.begin();
        if(itr->first == 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    if(m.size() == 2)
    {
        auto itr = m.begin();
        if(itr->first == 0 && itr->second == n/3 && n % 3 == 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    if(m.size() == 3)
    {
        auto itr = m.begin();
        ll a = itr->first;
        int sizea = itr->second;
        itr++;
        ll b = itr->first;
        int sizeb = itr->second;
        itr++;
        ll c = itr->first;
        int sizec = itr->second;
        if(sizea == sizeb && sizea == sizec && (a^b^c) == 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    if(m.size() >= 4) cout << "No" << endl;
}



Measured memory_bytes: 3840
import java.util.*;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        System.out.println(Math.max(Math.max(a+b, a-b), a*b));
    }
}

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

int main ()
{
   unsigned long long x;
    cin>>x;
    unsigned long long c=100;
    int y=0;
    while(c<x)
    {
     c+=c/100;
     y++;
    }
    cout<<y<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define int long long 
typedef pair<int,int>pi;
typedef vector<int>vi;

const int MAXN=200005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

int N;
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	int ans = 0;
	FOR(i,1,N){
		ans += i * (N-i+1);
	}
	FOR(i,1,N-1){
		int u,v; cin >> u >> v;
		if (u> v) swap(u,v);
		ans -= u*(N-v+1);
	}
	cout<<ans;
}


Measured memory_bytes: 3644
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int[] cost = new int[M];
    int[] open = new int[M];
    for (int i = 0; i < M; i++) {
      cost[i] = scanner.nextInt();
      int b = scanner.nextInt();
      for (int j = 0; j < b; j++) {
        int c = scanner.nextInt();
        open[i] |= 1 << (c - 1);
      }
    }
    int[] dp = new int[1 << N];
    int INF = 1_000_000_000;
    Arrays.fill(dp, INF);
    dp[0] = 0;
    for (int i = 0; i < M; i++) {
      for (int j = 0; j < 1 << N; j++) {
        int k = j | open[i];
        dp[k] = Math.min(dp[k], dp[j] + cost[i]);
      }
    }
    if (dp[(1 << N) - 1] == INF) {
      System.out.println(-1);
    } else {
      System.out.println(dp[(1 << N) - 1]);
    }
  }
}


Measured memory_bytes: 31456
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2005;
const int ha=1000000007;
int jc[maxn*maxn],ni[maxn*maxn];
int n,k,f[maxn][maxn];
inline int add(int x,int y)
{
	x+=y;
	return x>=ha?x-ha:x;
}
inline int ksm(int x,int y)
{
	int an=1;
	for(;y;y>>=1,x=x*(ll)x%ha) 
	if(y&1) 
	an=an*(ll)x%ha;
	return an;
}
inline void init()
{
	jc[0]=1;
	for(int i=1;i<=4004000;i++) jc[i]=jc[i-1]*(ll)i%ha;
	ni[4004000]=ksm(jc[4004000],ha-2);
	for(int i=4004000;i;i--) ni[i-1]=ni[i]*(ll)i%ha;
}
inline int getC(int x,int y)
{
	return jc[x]*(ll)ni[y]%ha*(ll)ni[x-y]%ha;
}
inline void dp()
{
	f[0][0]=1;
	for(int i=0;i<=n;i++)
	    for(int j=i;j>=0;j--) 
		if(f[i][j])
		{
	    	f[i+1][j+1]=add(f[i+1][j+1],f[i][j]*(ll)(n-i)%ha*(ll)getC(k*(i+1)-j-2,k-2)%ha);
	    	if(j) 
			f[i][j-1]=add(f[i][j-1],f[i][j]);
		}
}
int main(){
	init();
	cin>>n>>k;
	if(k==1) 
	cout<<"1";
	else{
		dp();
		cout<<f[n][0];
	}
	return 0;
}

Measured memory_bytes: 46464