akhauriyash/Code-Regression huggingface dataset:
//written by libra9z
#define LOCAL_TIME
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> pii;
typedef pair <ll,int> plli;
typedef pair <int,pii> pipii;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <pii> vpii;
typedef vector <vector<int> > mat;
#define rep(i,n) for (int i=0;i<(n);i++)
#define Rep(i,a,b) for (int i=(a);i<=(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rRep(i,a,b) for (int i=(a);i>=b;i--)
#define repit(it,a) for ((__typeof(a.begin())) it=a.begin();it!=a.end();it++)
#define repx(x,a) for (auto x:a)
#define pb push_back
#define mp make_pair()
#define eb emplace_back
#define X first
#define Y second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Debug(x) cerr<<#x<<" = "<<x<<endl
#define Debug22(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl
#define Debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")\n"
#define Debug3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<")\n"
#define Debug_arr(v,n) for(int i=0;i<n;++i) cerr<<#v<<"["<<i<<"]"<<" = "<<v[i]<<endl
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define prl cerr << "called: " << __LINE__ << endl
#define get1(x,a) x>>a
#define get2(x,a,b) x>>a>>b
#define get3(x,a,b,c) x>>a>>b>>c
#define getn(x,n,v) rep(i,n) x>>v[i]
#define put1(x,a) x<<a
#define put2(x,a,b) x<<a<<" "<<b
#define put3(x,a,b,c) x<<a<<" "<<b<<" "<<c
#define putn(x,n,v) rep(i,n) x<<v[i]<<" ";
#define eaq(n,x) __typeof(x) n=x;
#define RET(p,x) return p<<x<<endl,0;
const ll h1=999999937;
const ll h2=1000000009;
const int inf=2e9;
const ll mod=1000000007;
const int dx[]={1,0,-1,0,1,0,-1,0};
const int dy[]={0,1,0,-1,1,0,-1,0};
const double pi=3.141592653589793;
const bool multitests=false,alotoftests=false;
ifstream fin("input.txt");ofstream fout("output.txt");
stringstream sinout;
int c[10][10],n,m;
void floyd()
{
	for (int i=0;i<10;++i)
	{
		for (int j=0;j<10;++j)
		{
			for (int k=0;k<10;++k)
			{
				if (c[i][k]+c[k][j]<c[i][j])
				{
					c[i][j]=c[i][k]+c[k][j];
				}
			}
		}
	}
}
bool solve(int __test)
{
	cin>>n>>m;
	for (int i=0;i<10;++i)
	{
		for (int j=0;j<10;++j)
		{
			cin>>c[i][j];
		}
	}
//	for (int i=0;i<10;++i)
//	{
//		for (int j=0;j<10;++j)
//		{
//			cerr<<c[i][j]<<" ";
//		}
//		cerr<<endl;
//	}
	for (int i=0;i<100;++i) floyd();
	int ans=0;
	for (int i=0;i<n;++i)
	{
		for (int j=0;j<m;++j)
		{
			int x;
			cin>>x;
			if (x==-1)
			{
				continue;
			}
			ans+=c[x][1];
		}
	}
	cout<<ans<<endl;
	return false;
}
signed main()
{
	int __tests,__test=1;
	(multitests==true)?((alotoftests==false)?scanf("%d",&__tests):__tests=inf):__tests=1;
	for (;(alotoftests==true && multitests==true)?(!solve(__test)):(__test<=__tests);++__test)
	{
		if (!(multitests==true && alotoftests==true))
		{
			solve(__test);
		}
	}
	#ifdef LOCAL_TIME
	eprintf("\n\nSystem Time : %d ms",clock());
	#endif
	fin.close();fout.close();
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 123450
#endif

int N,M,Q;

void solve() {
    int ans = -1;
    int a;
    REP1(i,5) {
        cin>>a;
        if (a==0) ans = i;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3540
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N=ii()
    A=lmis()
    d=defaultdict(int)
    for a in A:
        a -= 1
        d[a]+=1
    for i in range(N):
        print(d[i])



main()



Measured memory_bytes: 41028
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d",&a,&b);
if((a==1 && b==2)||(a==2&&b==1)){
printf("3");}
else if ((a==1&&b==3)||(a==3&&b==1)){
        printf("2");}
else printf("1");
return 0;}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
a, p = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

ans = (3*a+p)//2
print(ans)

Measured memory_bytes: 9008
def check(x, y)
  2.times do |z|
    4.times do
      return true if x == y
      a, b, c, d, e, f  = x
      x = z.zero? ? [e, a, c, d, f, b] : [d, b, a, f, e, c]
      h = x
      4.times do
        i, j, k, l, m, n = h
        h = [i, k, m, j, l, n]
        return true if h == y
      end
    end
  end
  false
end
 
g, *h = $<.map{|i| i.chomp.split}
g[0].to_i.times do |j|
  (j+1).upto(g[0].to_i - 1) do |k|
    (puts 'No')^exit if check(h[j], h[k])
  end
end
puts 'Yes'

Measured memory_bytes: 9884
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  string s;
  cin >> s;
  if (s[0] != 'A') {
    cout << "WA" << endl;
    return 0;
  }
  if (count(s.begin()+2, s.end() - 1, 'C') != 1) {
    cout << "WA" << endl;
    return 0;
  }
  ll lower_count = 0;

  rep(i, ll(s.size()))
    if (islower(s[i]))
      lower_count++;

  if (lower_count != ll(s.size()) - 2) cout << "WA" << endl;
  else cout << "AC" << endl;

  return 0;
}


Measured memory_bytes: 256
import sys

def main(lines):
    # このコードは標準入力と標準出力を用いたサンプルコードです。
    # このコードは好きなように編集・削除してもらって構いません。
    # ---
    # This is a sample code to use stdin and stdout.
    # Edit and remove this code as you like.

    for i, v in enumerate(lines):
        print("line[{0}]: {1}".format(i, v))
        
if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append([int(s) for s in l.rstrip('\r\n').split()])
A=lines[0][0]
B=lines[0][1]
print(A*B)

Measured memory_bytes: 9196
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}
#[allow(unused_imports)]
use input::*;

fn main() {
    let (x, a, b): (isize, isize, isize);
    input!(x, a, b);
    if (x - a).abs() > (x - b).abs() {
        println!("B");
    } else {
        println!("A");
    }
}

Measured memory_bytes: 4352
N = int(input())
As = [int(ai) for ai in input().split(' ')]
Bs = [int(bi) for bi in input().split(' ')]
S = sum(As)

As = As[::-1]
Bs = Bs[::-1]

for i in range(N):
    diff = As[i] - Bs[i]
    if diff >= 0:
        As[i] = diff
        Bs[i] = 0
    else:
        As[i] = 0
        As[i+1] = max(0, As[i+1]+diff)

print(S-sum(As))

Measured memory_bytes: 18624
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s = sc.next();
		System.out.println("" + s.charAt(0) + (s.length() - 2) + s.charAt(s.length() - 1));
	}
}

Measured memory_bytes: 25172
#include <stdio.h>
#include <string.h>
#define buf 100

int main(void){
     
	int i,l,n,m,B,C;
	char str[buf],s[buf],*line;
	
	fgets(s,sizeof(str),stdin);
	sscanf(s,"%d",&m);
	for(l=0;l<m;l++){
		fgets(str,sizeof(str),stdin);
		line=strtok(str," ");
		sscanf(line,"%d",&n);
		B=n; C=0;
		for(i=1;i<10;i++){
			line=strtok(NULL," ");
			sscanf(line,"%d",&n);
			if(n>B)
				B=n;
			else if(n>C)
				C=n;
			else{
				printf("NO\n");
				goto out;
			}
		}
		printf("YES\n");
		out:;			
	}	
	return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int n,k,r,s,p;
    string t;
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >>t;
    //rはグー、sはチョキ、pはパー
    long long int sum = 0;
    vector<bool> win(n,true);
    bool pre = false;//k個前で勝ってたならtrue
    for(int i=0;i<n;i++){
        if(win[i]){
            if(t[i]=='r'){//パーで勝つ
                sum += p;
            }
            if(t[i]=='s'){//グーでかつ
                sum += r;

            }
            if(t[i]=='p'){//チョキで勝つ
                sum += s;
            }
            if(i+k<n && t[i]==t[i+k]){
                win[i+k]=false;
            }
        }
        //cout << sum << endl;
    }
    cout << sum << endl;

}

Measured memory_bytes: 512
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    array<array<int, 3>, 3> A;
    rep(i, 3) {
        rep(j, 3) {
            cin >> A[i][j];
        }
    }
    int N;
    cin >> N;
    vector<pair<int, int>> B(N);
    rep(x, N) {
        int tmp;
        cin >> tmp;
        rep(i, 3) {
            rep(j, 3) {
                if(tmp == A[i][j]) {
                    A[i][j] = 0;
                }
            }
        }
    }

    rep(i, 3) {
        if(A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0) {
            cout << "Yes" << endl;
            return 0;
        }
        if(A[0][i] == 0 && A[1][i] == 0 && A[2][i] == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0) {
            cout << "Yes" << endl;
            return 0;
    }
    if(A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0) {
            cout << "Yes" << endl;
            return 0;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
let N = Int(readLine()!)!
var ans = "Yes"
var (preT, preX, preY) = (0, 0, 0)
for _ in 0..<N {
  let input = readLine()!.characters.split(" ").map{Int(String($0))!}
  let (t, x, y) = (input[0], input[1], input[2])
  let (dt, dx, dy) = (t - preT, abs(x - preX), abs(y - preY))
  let overTime = dt - (dx + dy)
  if overTime < 0 || overTime % 2 > 0 {
    ans = "No"
  }
  (preT, preX, preY) = (t, x, y)
}
print(ans)

Measured memory_bytes: 4080
#pragma GCC target("avx2")
#pragma GCC optimize("O3")

# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
   SpeedForce;
	cin >> n >> k;
	for (int i = 1; i <= n; i ++) {
		cin >> cur;
		ans += (cur >= k);
	}
	cout << ans;
   return Accepted;
}

// B...a

Measured memory_bytes: 18688
#include<stdio.h>
#include<string.h>

int main(void){
	int c[128]={0},i;
	char s[128];
	scanf("%s",s);
	for(i = 0;i < strlen(s);i++){c[s[i]]++;}
	for(i = 'a';i <= 'z';i++){if(c[i]%2){printf("No\n");return 0;}}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z) cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair<int, int>
#define ld long double
using namespace std;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  string news = "NSEW";
  int cnt[4];
  REP(i, 4) cnt[i] = count(ALL(S), news[i]);
  REP(i, 2) {
    REP(j, 2) {
      if ((cnt[2 * i] == 0 && cnt[2 * i + 1] > 0)) {
        print("No");
        return 0;
      }
      swap(cnt[2 * i], cnt[2 * i + 1]);
    }
  }
  print("Yes");
}

Measured memory_bytes: 256
def f(n):
  if n in d: return d[n]
  if n==1: return 0
  if n % 2 ==0: c = f(n/2)+1
  else: c = f(n*3+1)+1
  d[n] = c
  return c

d = {}
while 1:
  n = int(raw_input())
  if n==0: break
  print f(n)

Measured memory_bytes: 4284
def main():
    s = input()
    ans = solve(s)
    print(ans)


def solve(s):
    if s == 'Sunny':
        return 'Cloudy'
    elif s == 'Cloudy':
        return 'Rainy'
    elif s == 'Rainy':
        return 'Sunny'
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using v = vector<ll>;
using p = pair<ll,ll>;

void a(){
    ll h,a;
    cin >> h >> a;
    cout << (h%a==0? h/a:h/a+1);
}

void b(){
    ll h,n;
    cin >> h >> n;
    auto a = v(n,0);
    for(ll i=0;i<n;i++) cin >> a[i];
    ll sum = accumulate(a.begin(),a.end(),0);
    cout << (sum>=h?"Yes":"No");
}

void c(){
    ll n,k;
    cin >> n >> k;
    auto h = v(n,0);
    for(ll i=0;i<n;i++){
        cin >> h[i];
    }
    sort(h.begin(),h.end(),greater<ll>());
    if(n<=k) {
        cout << 0 << endl;
        return;
    }
    auto sum = accumulate(h.begin()+k,h.end(),(ll)0);
    cout <<sum<<endl;

}
auto bit = v(10000,0);
void func(ll x){
    bit[0] = 1;
    ll i=0;
    while(x!=0){
        bit[i+1]=bit[i]*2;
        x/=2;
        i++;
    }
}

void d(){
    ll h;
    cin >> h;
    ll c=0,ans=0;
    func(h);

    while(h!=0){
        h/=2;
        ans += bit[c];
        c++;
    }
    cout << ans;
}
int main(){
    d();
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

/* #include <bits/stdc++.h> */

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    int n,m;
    while (cin >> n >> m) {
        map<int,int> cnt;
        FOR(i,1,n+1) {
            int a; cin >> a;
            cnt[a]++;
        }
        FOR(_,0,m) {
            int b,c; cin >> b >> c;
            cnt[c] += b;
        }
        auto i = cnt.rbegin(); int total = 0; LL ans = 0;
        while (total < n) {
            const int x = min(i->second, n-total);
            ans += 1LL* i->first * x;
            total += x; i->second -= x;
            if (i->second == 0)
                ++i;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 9600
import sys
input = sys.stdin.readline

n = int(input())
a_lst = list(map(int, input().split()))
a_lst.sort()

if a_lst[0] == 0:
    answer = 0
else:
    answer = 1
    for i in range(n):
        a = a_lst[i]
        answer *= a

        if answer > 10 ** 18:
            answer = -1
            break

print(answer)

Measured memory_bytes: 21604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<int> p(N);
  for (int i = 0; i < N; i++){
    cin >> p.at(i);
  }  
  sort(p.begin(), p.end());
  
  p.at(N-1) = p.at(N-1)/2;
  
  int sum = 0;
  for (int i = 0; i < N; i++){
    sum += p.at(i);
  } 
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

int d[2][100];

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  int ans = 0;
  forn(i,n){
    cin >> a[i];
    a[i]--;
    if (a[i] < i){
      if (a[a[i]] == i) ans++;
    }
  }
  cout << ans;
}

int main() {
  ios::sync_with_stdio(false);
  // cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 


*/

Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
void dfs(int len,string now,int mx){
	if(len==n+1){
		cout<<now<<endl;
		return ;
	}
	for(int i=0;i<=mx+1&&i<len;i++){
		char x=i+'a';
		dfs(len+1,now+x,max(mx,i));
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	dfs(2,"a",0);
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);


ll pow_mod(ll n, ll m, ll mod=998244353){
    ll a = 1;
    while(m>0){
        if(m&1) a = a*n % mod;
        n = n*n % mod;
        m >>= 1;
    }
    return a;
}


ll combi(ll n, ll m, ll mod=998244353){
    static const ll N_MAX = 200002;
    static vll fac(N_MAX+1, -1);
    static vll ifac(N_MAX+1, -1);

    if(fac[0]<0){
        fac[0] = ifac[0] = 1;
        rep(i, N_MAX){
            fac[i+1] = fac[i] * (i+1) % mod;
            ifac[i+1] = ifac[i] * pow_mod(i+1, mod-2, mod) % mod;
        }
    }

    if(n<=0 && m<=0) return 1;
    if(n<m || n<0) return 0;
    return (ifac[n-m] * ifac[m] % mod) * fac[n] % mod;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll N, M, K;
    cin >> N >> M >> K;

    ll total = 0;
    rep(i, K+1){
        ll t1 = combi(N-1, i);
        ll t2 = M * pow_mod(M-1, N-1-i) % 998244353;
        ll t = t1*t2 % 998244353;
        total = (total+t) % 998244353;
    }
    cout << total << endl;
}


Measured memory_bytes: 6344
a,b,k = map(int,input().split())

if a>=k:
    ans1 = a - k
    ans2 = b
else:
    ans1 = 0
    if b>=(k-a):
        ans2 = b - (k-a)
    else:
        ans2 = 0 

print(ans1,ans2)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll n;
    cin>>n;
    loop(i,20){
        ll now=i*1000;
        if(now>=n){
            putout(now-n);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>

int main() {
	const std::string w[] = {"Sunny", "Cloudy", "Rainy"};

	std::string s;
	std::cin >> s;

	for (int i = 0; i < 3; ++i)
		if (s == w[i])
			std::cout << w[(i + 1) % 3] << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <cmath>

using namespace std;

#define int long long

#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

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

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int inf = TEN(9) + 10;
const int mod = TEN(9) + 7;

signed main()
{
	int n; cin >> n;
	vector<pii> p;
	rep(i, n) {
		double x, y; cin >> x >> y;
		p.PB(x, y);
	}

	sort(all(p));

	double sum = 0;

	int d = 0;
	do {
		rep(i, n - 1) {
			double dx = p[i].fst - p[i+1].fst, dy = p[i].scd - p[i+1].scd;
			sum += sqrt(dx*dx + dy*dy);
		}
		d++;
	} while (next_permutation(all(p)));


	printf("%.10f\n", sum / d);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using ll = long long;
using namespace std;

int main(void) {

    // ll ans = 0;
    int N;
    cin >> N;

    ll Tak=1, Ao=1;
    // cin >> Tak >> Ao;
    // ll pTak, pAo;
    ll cTak, cAo;

    for (int i = 0; i < N; ++i) {
        // solve
        cin >> cTak >> cAo;
        // ll n = max({ceil(double(Tak)/cTak), ceil(double(Ao)/cAo)});
        ll n = max({(Tak+cTak-1)/cTak, (Ao + cAo -1)/cAo});
        Tak = n * cTak;
        Ao = n * cAo;
    }

    cout << Tak + Ao << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<pair<int, int>> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i].first >> v[i].second;
	}
	sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b) -> bool{
		return a.second < b.second;
	});
	int T = 0;
	for (int i = 0; i < N; i++) {
		T += v[i].first;
		if (T > v[i].second) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 1792
from collections import Counter


def main():
    n = int(input())
    A = list(map(int, input().split()))
    a_c = Counter(A)
    a_s = list(set(A))
    tot = 0
    for a in a_s:
        tot += a_c[a] * (a_c[a] - 1) // 2
    ans = list(map(lambda x: tot - (a_c[x] - 1), a_s))
    ans_dic = dict(zip(a_s, ans))
    for a in A:
        print(ans_dic[a])


if __name__ == "__main__":
    main()

Measured memory_bytes: 38488
#include <stdio.h>
#include <math.h>

int main (void)
{
	double x1,y1,x2,y2;
	double kyo1,kyo2,kyo,hei;
	
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	kyo1 = (y1-y2)*(y1-y2);
	if(kyo1<0)
	{
		kyo1 = -1*kyo1;
	}
	
	kyo2 = (x1-x2)*(x1-x2);
	if(kyo2<0)
	{
		kyo2= -1 * kyo2;
	}

	kyo =kyo1 + kyo2;
	if(kyo<0)
	{
		kyo = -1 * kyo;
	}

	hei = sqrt(kyo);

	printf("%.8f\n",hei);

	return 0;
}

Measured memory_bytes: 656
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
     
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0){
        int[] s = new int[n];
        double ave = 0;
        int i;
 
        for(i=0; i<n; i++){
            s[i] = kbd.nextInt();
            ave += s[i];
        }
        ave = ave/n;
 
        double a=0;
        for(i=0; i<n; i++){
            a += (s[i]-ave)*(s[i]-ave);
        }
        a = a/n;
        a = Math.sqrt(a);
 
        System.out.println(a);
        }
    }
    }
}

Measured memory_bytes: 23776
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
string s, t;
int ans = 100;
bool check(char c, int n)
{
    rep(i, n)
    {
        if (t[i] != c)
        {
            return false;
        }
    }
    return true;
}

int cnt(char c, int n)
{
    rep(i, n)
    {
        if (check(c, n - i))
        {
            return i;
        }
        rep(i, n - 1)
        {
            if (t[i + 1] == c)
                t[i] = c;
        }
    }
    return n;
}

int main()
{
    cin >> s;
    rep(i, 26)
    {
        t = s;
        ans = min(ans, cnt((char)('a' + i), s.length()));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include<tuple>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n;
    int a[55]={};
    scanf("%d",&n);
    REP(i,n)scanf("%d",&a[i]);
    int dif=0;
    REP(i,n){
        if(a[i]!=i+1)dif++;
    }
    if(dif==2 || dif==0)printf("YES\n");
    else printf("NO\n");
    return 0;
}

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    ll n, k;
    cin >> n >> k;
    ll ans = (ll)(n / k) * (ll)(n / k) * (ll)(n / k);
    if(k % 2 == 0){
        ans += (ll)((n + (k / 2)) / k) * (ll)((n + (k / 2)) / k) * (ll)((n + (k / 2)) / k);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = gets.to_i
a = 1
for i in 2..n
    a = a * i
end


array = Array.new(1000000, 0)
key = 2

while a != 1
    if a%key == 0
        array[key] += 1
        a = a / key
    else
        key += 1
    end
end

ans = 1

for i in 2..key
    if array[i] != 0
        ans = ans * (array[i] + 1) % (1000000007)
    end
end

puts ans


Measured memory_bytes: 11004
N = int(input())

ans = ''

while True:
    n = int(N / 26)
    r = N % 26

    if r == 0:
        r = 26
        n -= 1

    ans = chr(96 + r) + ans
    if n == 0:
        break
    else:
        N = n

print(ans)

Measured memory_bytes: 9076
#coding:utf-8

def main():
    h, n = map(int, input().split())
    ab = []
    for _ in range(n):
        ab.append(list(map(int, input().split())))
    
    inf = 100000000000
    # indexがモンスターに与えたダメージで、中身がトキのダメージ
    damages = [0] + [inf] * h
    for i in range(1, h + 1):
        for j in range(n):
            damage_monster = ab[j][0]
            damage_toki = ab[j][1]
            
            damages[i] = min(damages[max(0, i - damage_monster)] + damage_toki, damages[i])


    print(min(damages[h:]))
main()

Measured memory_bytes: 41072
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#include <set>

using namespace std;

const int MAXN = 1e2 + 5;
const int MAXV = 1e5 + 5;
const int INF = 1e9 + 10;

struct item
{
    int v;
    int w;

    item(){};
    item(int _v, int _w)
    {
        v = _v;
        w = _w;
    }
};

int n, we;
item a[MAXN];
int T[MAXN][MAXV];

void read_input()
{
    scanf("%d %d", &n, &we);

    for(int i = 0; i < n; i++)
    {
        scanf("%d %d", &a[i].w, &a[i].v);
    }
}

void solve()
{
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j <= MAXV; j++)
        {
            T[i][j] = INF;
        }
    }

    T[0][a[0].v] = a[0].w;
    T[0][0] = 0;

    for(int i = 1; i < n; i++)
    {
        for(int j = 0; j <= MAXV; j++)
        {
            T[i][j] = min(T[i - 1][j], T[i][j]);
            if(j - a[i].v < 0 || T[i - 1][j - a[i].v] == INF) continue;
            T[i][j] = min(T[i][j], T[i - 1][j - a[i].v] + a[i].w);

        }
    }


    for(int i = MAXV - 1; i >= 0; i--)
    {
        if(T[n - 1][i] <= we)
        {
            printf("%d\n", i);
            break;
        }
    }
}

int main()
{
    read_input();
    solve();

    return 0;
}

/*
88 100000000
1001 5
1002 7
1003 7
1004 7
1005 7
1006 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
100 5
204 7
107 7
54 7
93 7
16 7
27 7
91 7
97 7
56 7
57 7
*/


Measured memory_bytes: 41088
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    vll a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ll low, high;
    if (n % 2 == 0)
    {
        rep(i, n)
        {
            a[i] *= 2;
            b[i] *= 2;
        }
        low = (a[n / 2] + a[n / 2 - 1]) / 2;
        high = (b[n / 2] + b[n / 2 - 1]) / 2;
    }
    else
    {
        low = a[n / 2];
        high = b[n / 2];
    }

    ll ans = high - low + 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6424
#include <stdio.h>

double a,b,c,d,e,f,x,y;

int main()
{
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
		x = (c*e-f*b)/(a*e-d*b);
		y = (c-a*x)/b;
		printf("%.3f %.3f\n",x+(1e-10),y+(1e-10));
	}
return 0;
}

Measured memory_bytes: 656
//In The Name Of God
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<vii> vvii;

#define forn(i, n) for (int i = 0; i < n; i++)
#define forr(i, n) for (int i = n; i >= 0; i--)
#define forne(i, x, n) for (int i = x; i < n; i++)
#define forre(i, x, n) for (int i = n; i >= x; i--)
#define all(a) (a).begin(), (a).end()
#define inf 1000000000
#define eps 1e-9
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(0);
    string str, good = "ACTG"; cin >> str;
    int ans = 0;
    forn(i, str.size()) {
        int cur = 0;
        forne(j, i, str.size()) {
            if (good.find(str[j]) == good.npos)
                break;
            cur++;
        }
        ans = max(ans, cur);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

using namespace std;

typedef long long ll;

int main() {

	string s;
	cin >> s;
	char a = ' ';
	char b = ' ';
	int cnt1 = 0;
	int cnt2 = 0;
	bool flag = true;
	for (int i = 0; i < 4; i++)
	{
		if (cnt1 == 0) {
			a = s[i];
			cnt1++;
			continue;
		}
		if (a == s[i]) {
			cnt1++;
			if (cnt1 == 3) {
				flag = false;
				break;
			}
		}
		else {
			if (cnt2 == 0) {
				b = s[i];
				cnt2++;
				continue;
			}
			if (b == s[i]) {
				cnt2++;
				if (cnt2 == 3) {
					flag = false;
					break;
				}
			}
			else {
				flag = false;
				break;
			}
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int a[100],n,t;
void xzsort(int n)
{
	int i,j,minn,mini;
	for(i=0;i<n-1;i++)
	{
		mini=i;
		minn=a[i];
		for(j=i+1;j<n;j++)
		{
			if(a[j]<minn)
			{
				minn=a[j];
				mini=j;
			}
		}
		if(i!=mini)
		{
		t++;
		swap(a[i],a[mini]);
		}
	}
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	xzsort(n);
	for(int i=0;i<n-1;i++)
	cout<<a[i]<<" ";
	cout<<a[n-1]<<endl;
	cout<<t<<endl;
	return 0;
 } 


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

int main(){
  int a,b;
  cin >> a >> b;
  
  int ans = 0;
  bool flag = true;
  rep(i,1000){
    int at = floor(i*0.08);
    int bt = floor(i*0.10);
    if(at==a && bt == b){
      ans = i;
      flag = false;
      break;
    }
  }
  if(flag){
    cout << "-1" << endl;
  }else{
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n,m; cin >> n >> m;
    vector<ll> x(n),y(m); 
    rep(i,n) cin >> x[i];
    rep(i,m) cin >> y[i];

    ll xsum = 0;
    for(int i=0;i<n-1;i++){
        ll tmp = (x[i+1] - x[i]) * (i+1) % mod;
        tmp *= (n-i-1);
        tmp %= mod;
        xsum += tmp;
        xsum %= mod;
    }

    ll ysum = 0;
    for(int i=0;i<m-1;i++){
        ll tmp = (y[i+1] - y[i]) * (i+1) % mod;
        tmp *= (m-i-1);
        tmp %= mod;
        ysum += tmp;
        ysum %= mod;
    }

    ll ans = xsum * ysum % mod;
    cout << ans << endl;
}


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

int Min[100005];
int num[222] = {0, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
int n;

int main(){
	for(int i = 1; i <= 100000; i++){
		Min[i] = Min[i - 1] + 1;
		for(int j = 1; j <= 11; j++){
			if(i >= num[j]) Min[i] = min(Min[i - num[j]] + 1, Min[i]);
			else break;
		}
	}
	scanf("%d", &n);
	printf("%d\n", Min[n]);
} 

Measured memory_bytes: 4168
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 500005;

string s;

int main() {
cin >> s;
if (s[2] == s[3] && s[4] == s[5]) printf("Yes\n"); else printf("No\n");
return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define rt return
using dbl = double;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const int R = 201, INF = INT_MAX / 3;
/*
途中でカウンタが負にならない

最後にカウンタが0になる
*/
pair<int, string> dp[R][R];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N;
    cin >> N;
    string S;
    cin >> S;

    int cnt = 0, mi = 0;
    each(c, S) {
        if (c == '(')cnt++;
        else cnt--;
        smin(mi, cnt);
    }

    S = string(-mi, '(') + S;
    cnt = 0;
    each(c, S) {
        if (c == '(')cnt++;
        else cnt--;
    }
    S += string(cnt, ')');

    cout << S << endl;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

ll a[N];
int main()
{
	int n;
	cin >> n;
	ll s = 0;
	for(int i = 1; i <= n; i ++)
		cin >> a[i], s ^= a[i];
	for(int i = 1; i <= n; i ++)
		cout << (a[i] ^ s) << ' ';





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 5080