akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  vector<ll> S(N+1,0);
  for(int i=0; i<N; i++){
    S[i+1] = S[i] + A[i];
  }
  int k=0;
  for(int i=N-1; i>=0; i--){
    if(A[i] > S[i]*2){
      k = i;
      break;
    }
  }
  cout << N-k << endl;
  return 0;
}


Measured memory_bytes: 1920
import kotlin.math.ceil

fun main(args: Array<String>) {
    val (a, b) = readIntList()
    val ans = ceil((b.toDouble() - a) / (a - 1)) + 1
    println(ans.toInt())
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

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

int main(){
    long long x , y ;
    cin >> x >> y ;
    int cnt = 0 ;
    for(long long i=x;;i+=i){
        if ( i <= y ) cnt++;
        else break;
    }
    cout << cnt << endl;

    return 0 ;
}


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

int main()
{
    int n,i;
    cin >> n;
    vector<int> a(n+1);
    vector<int> b(n);
    for(i = 0;i <= n;++i){
        cin >> a.at(i);
    }
    for(i = 0;i < n;++i){
        cin >> b.at(i);
    }
    int tempa,tempb;
    long long sum = 0;
    for(i = 0;i < n;++i){
        if(a.at(i)){
            tempa = a.at(i);
            tempb = b.at(i);
            a.at(i) -= min(tempa,tempb);
            b.at(i) -= min(tempa,tempb);
            sum += min(tempa,tempb);
            if(b.at(i)){
                tempa = a.at(i+1);
                tempb = b.at(i);
                a.at(i+1) -= min(tempa,tempb);
                sum += min(tempa,tempb);
            }
        }else{
            tempa = a.at(i+1);
            tempb = b.at(i);
            a.at(i+1) -= min(tempa,tempb);
            sum += min(tempa,tempb);
        }
    }
    cout << sum << endl;
    return 0;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

struct Comb
{
	const long long mod;
	vector<long long> fac, ifac;

	Comb(long long n, long long m) : mod(m)
	{
		fac.resize(n+1);
		ifac.resize(n+1);

		fac[0] = 1;
		ifac[0] = 1;
		for (long long i = 0; i < n; ++i)
		{
			(fac[i+1] = fac[i]*(i+1)) %= mod;
			(ifac[i+1] = ifac[i]*mpow(i+1, mod-2)) %= mod;
		}
		
	}

	long long mpow(long long x, long long n)
	{ 
		long long ans = 1;
		while(n != 0){
			if(n&1) ans = ans*x % mod;
			x = x*x % mod;
			n = n >> 1;
		}
		return ans;
	}

	long long comb(long long a, long long b)
	{ 
		if(a == 0 && b == 0)return 1;
		if(a < b || a < 0)return 0;
		long long tmp = ifac[a-b]* ifac[b] % mod;
		return tmp * fac[a] % mod;
	}
};


int main(int argc, char **argv)
{
	ll N, K; cin >> N >> K;
	Comb c(2*100010, MOD);

	ll res{0};
	REP(i, min(K, N-1)+1)
	{
		(res += c.comb(N, i) * c.comb(N-1, N-i-1)) %= MOD;
	}
	std::cout << res << std::endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
 
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };
 
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end());
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, n);
    Cins(int, n, s);
    Sort(s);
    int ans = Sum(s);
    if(ans % 10 == 0){
        For(i, n+1){
            if(s[i] % 10 != 0){
                ans -= s[i];
                break;
            }
            if(i == n) ans = 0;
        }
    }
    Cout(ans);
}

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

int main() {
    ll D,N;
    cin >> D >>N;
    if(N==100){
        N++;
    }

    ll num =1;
    for(int i=0;i<D;i++){
        num *= 100;
    }
    cout << num*N << endl;

    return 0;
}

Measured memory_bytes: 3624
n,m = map(int,input().split())

matrix_a = [list(map(int,input().split(" "))) for i in range(n)]

matrix_b = [int(input()) for i in range(m)]

for i in range(n):
    answer = sum([matrix_a[i][j] * matrix_b[j] for j in range(m)])
    print(answer)

Measured memory_bytes: 8036
import java.io.*;
import java.util.Scanner;

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

        int n = in.nextInt();
        boolean canTravel = true;

        int prevT = 0;
        int prevX = 0;
        int prevY = 0;

        for (int i = 0; i < n; i++) {
            int t = in.nextInt();
            int x = in.nextInt();
            int y = in.nextInt();

            canTravel = canTravel && canEvenOdd(x - prevX, y - prevY, t - prevT);
            canTravel = canTravel && insideDiamond(x - prevX, y - prevY, t - prevT);

            prevT = t;
            prevX = x;
            prevY = y;
        }
        
        if (canTravel) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    private static boolean canEvenOdd(int x, int y, int t){
        int absX = Math.abs(x);
        int absY = Math.abs(y);
        int absT = Math.abs(t);
        return (absX + absY) % 2 == absT % 2;
    }

    private static boolean insideDiamond(int x, int y, int segment){
        int absX = Math.abs(x);
        int absY = Math.abs(y);
        int absSegment = Math.abs(segment);
        return absY <= -absX + absSegment; 
    }
}



Measured memory_bytes: 87648
///////////////////////////////////////////
//?????§????????????????????¢???????????????????????°??????
//???????????§??????????????£????????¨?????????
///////////////////////////////////////////

#include<iostream>
using namespace std;

void ches1(int x)	//?\???°????????´?????????????????????('#'??????)
{
	for(int i = 0; i < x; i++){
		if(i %2 == 0)cout << '#';
		else if(i %2 == 1)cout << '.';
	}
}

void ches2(int x)	//??¶??°????????´???('.'??????)
{
	for(int i = 0; i < x; i++){
		if(i %2 == 0)cout << '.';
		else if(i %2 == 1)cout << '#';
	}
}

int main(){
	int H,W;

	while(1){
		cin >> H >> W;
		if(H == 0 && W == 0)break;

		for(int i = 0; i < H; i++){
			if(i %2 == 0)ches1(W);
			else if(i %2 == 1)ches2(W);
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
// Original: https://github.com/tanakh/competitive-rs
#[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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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")
    };
}

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:i64,k:i64
    }

    let mut total = 0;
    for b in 1..n + 1 {
        let row = n / b;
        total += row * max(0, b - k);
        let r = n % b;
        total += max(0, r - k + 1);

        if k == 0 {
            total -= 1;
        }
    }

    println!("{}", total);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    // ab ??¨ cd ????????????
    static bool IsParallel(Vec2 a, Vec2 b, Vec2 c, Vec2 d) {
        var ab = b - a;
        var cd = d - c;
        return ab.Cross(cd) == 0;
    }

    // ab ??¨ cd ????????´???
    static bool IsOrthogonal(Vec2 a, Vec2 b, Vec2 c, Vec2 d) {
        var ab = b - a;
        var cd = d - c;
        return ab.Dot(cd) == 0;
    }

    static int Calc(Vec2 a, Vec2 b, Vec2 c, Vec2 d) {
        if (IsParallel(a, b, c, d)) return 2;
        if (IsOrthogonal(a, b, c, d)) return 1;
        return 0;
    }

    static void Main() {
        var n = ReadInt();
        for (int i = 0; i < n; i++) {
            var ps = ReadInts();
            var a = new Vec2(ps[0], ps[1]);
            var b = new Vec2(ps[2], ps[3]);
            var c = new Vec2(ps[4], ps[5]);
            var d = new Vec2(ps[6], ps[7]);

            Console.WriteLine(Calc(a, b, c, d));
        }
    }
}

struct Vec2 {
    public double X { get; private set; }
    public double Y { get; private set; }

    public Vec2(double x, double y) : this() {
        X = x;
        Y = y;
    }

    public override string ToString() {
        return string.Format("({0}, {1})", X, Y);
    }

    public static Vec2 operator+(Vec2 a, Vec2 b) {
        return new Vec2(a.X + b.X, a.Y + b.Y);
    }

    public static Vec2 operator-(Vec2 a, Vec2 b) {
        return new Vec2(a.X - b.X, a.Y - b.Y);
    }

    public static Vec2 operator*(Vec2 a, double t) {
        return new Vec2(a.X * t, a.Y * t);
    }

    public static Vec2 operator*(double t, Vec2 a) {
        return new Vec2(a.X * t, a.Y * t);
    }

    // a???b = |a||b|cos??
    public double Dot(Vec2 other) {
        return X * other.X + Y * other.Y;
    }

    public double Cross(Vec2 other) {
        return X * other.Y - Y * other.X;
    }

    public Vec2 Normalized() {
        var m = Magnitude();
        if (m != 0 && m != 1) {
            return new Vec2(X / m, Y / m);
        }
        return this;
    }

    public double Magnitude() {
        return Math.Sqrt(X * X + Y * Y);
    }

    public double SqrMagnitude() {
        return X * X + Y * Y;
    }

    public static double Distance(Vec2 a, Vec2 b) {
        return (a - b).Magnitude();
    }
}

Measured memory_bytes: 9832
#include <bits/stdc++.h>
using namespace std;
main () {
	int a,b;
	cin >>a >>b;
	if (b == 1) {
		cout <<0;
		return 0;
	}
	int ans = 1;
	int rol = 0;
	while (ans < b) {
		ans+=a;
		ans--;
		rol++;
	}
	cout <<rol;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main ()
{
    int a, b, c, x;
    cin >> a>> b >>c;
    if (a>b) {
        x=a;
        a=b;
        b=x;
    }
       if(b > c){
      x = b;
      b = c;
      c = x;

 

   }
   
   if(a > b){
      x = a;
      a = b;
      b = x;
      
   }
   
   cout << a << " " << b << " " << c << endl;
   
   return 0;
}


Measured memory_bytes: 3104
def extend(node, step)
  @edge_hash[node].each do |next_node|
    next if @done[next_node][(step + 1) % 3]
    @done[next_node][(step + 1) % 3] = true
    @que.push([next_node, step + 1])
  end
end

n, m = gets.chomp.split.map(&:to_i)
@edge_hash = Array.new(n + 1) { [] }
m.times do
  e1, e2 = gets.chomp.split.map(&:to_i)
  @edge_hash[e1].push(e2)
end
s, t = gets.chomp.split.map(&:to_i)

@que = [[s, 0]]
@done = Array.new(n + 1) { Array.new(3, false) }

until @que.empty?
  node, step = @que.shift

  if node == t && (step % 3).zero?
    puts step / 3
    exit 0
  end
  extend(node, step)
end

puts "-1"


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int main() {
    int a,b,c,d; cin >> a >> b >> c >> d;
    if(c == a+1){
        if(d == 1){
            if(b == 30 || b == 31 || b == 29 || b == 28){
                cout << 1 << endl;
            }else{
                cout << 0 << endl;
            }
        }else{
            cout << 0 << endl;
        }
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = Long.parseLong(sc.next());
        long t[] = new long[5];
        t[0]=Long.parseLong(sc.next());
        long min = t[0];
        for(int i=1; i<5; i++) {
            t[i]=Long.parseLong(sc.next());
            if(min > t[i]) min = t[i];
        }
        long m;
        if(N % min == 0) m = N / min + 4;
        else m = N / min + 5;
        System.out.println(m);
    } 
    
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n>=400 && n<=599)
  {
    cout<<8<<endl;
    return 0;
  }
  else if(n>=600 && n<=799)
  {
    cout<<7<<endl;
    return 0;
  }
  else if(n>=800 && n<=999)
  {
    cout<<6<<endl;
    return 0;
  }
  else if(n>=1000 && n<=1199)
  {
    cout<<5<<endl;
    return 0;
  }
 else if(n>=1200 && n<=1399)
  {
    cout<<4<<endl;
    return 0;
  }
  else if(n>=1400 && n<=1599)
  {
    cout<<3<<endl;
    return 0;
  }
 else if(n>=1600 && n<=1799)
  {
    cout<<2<<endl;
    return 0;
  }
  else if(n>=1800 && n<=1999)
  {
    cout<<1<<endl;
    return 0;
  }
  return 0;
}
  

Measured memory_bytes: 3628
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
  FAST_IO  
 
  const int LIM = 1e5;
  int pref[LIM + 5];
  bool isPrime[LIM + 5];
  memset(isPrime, true, sizeof isPrime);
  memset(pref, 0, sizeof pref);

  isPrime[0] = isPrime[1] = false;

  for(int prime = 2; prime * prime <= LIM; ++prime){
    if(!isPrime[prime]) continue;
    for(int composite = prime * prime; composite <= LIM; composite += prime){
      isPrime[composite] = false;
    }
  }

  for(int num = 1; num <= LIM; ++num){
    pref[num] = pref[num - 1];
    if(isPrime[num] && isPrime[(num + 1) / 2]) pref[num]++;
  }

  int N; cin >> N;

  while(N--){
    int left, right; cin >> left >> right;
    cout << pref[right] - pref[left - 1] << "\n";
  }


  return 0;
}

Measured memory_bytes: 1152
N,X = map(int,input().split())
if X==1 or X==2*N-1:
    print('No')
    exit()
print('Yes')

ans = [None] * (2*N-1)
ans[N-2] = X-1
ans[N-1] = X
ans[N] = X+1
a = 1
for i in range(2*N-1):
    if ans[i]: continue
    if a==X-1:
        a += 3
    ans[i] = a
    a += 1
print(*ans, sep='\n')

Measured memory_bytes: 19972
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var g = new int[] { 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };

            var ss = Console.ReadLine().Split();
            var x = int.Parse(ss[0]);
            var y = int.Parse(ss[1]);

            Console.WriteLine(g[x] == g[y] ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{
  int n, m;
  long a = 0;
  long b = 0;
  cin >> n >> m;//nは10の5乗数

  map<long, long> modmap;//ｍで割ったあまり,その個数

  long ans = 0;
  modmap[b] = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    b = (b + a) % m;
    ans += modmap[b]++; //modで二回同じ値が出るということは累積和についてbi-bjは割り切れる
    //更に、累積和で同じmodが複数でるということは、それらを並べることが可能なので総和は1+2+3+,,,というふうになる
  }



  cout << ans;

  return 0;
}


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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

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

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
    bool ret = true;
    if (x < 2) {
        ret = false;
    }
    for (LL i = 2; i <= sqrt(x); i++) {
        if (x%i == 0) {
            ret = false;
        }
    }
    return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

vector< vector<char> > grid;
int main(int argc, char const* argv[])
{
    int h,b;
    cin >> h >> b;
    grid = vector< vector<char> >(100,vector<char>(100,'#'));   // すべて黒で初期化
    for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 100; j++) {
            grid[i][j] = '.';                                   // 上半分を白くする
        }
    }

    // ここから白と黒のマスを挿入していく
    // 黒
    int b_count = 1;
    for (int i = 0; b_count < b; i+=2) {
        for (int j = 0; b_count < b and j < 100; j+=2) {
            grid[i][j] = '#';
            b_count++;
        }
    }
    // 白
    int h_count = 1;
    for (int i = 51; h_count < h; i+=2) {
        for (int j = 0; h_count < h and j < 100; j+=2) {
            grid[i][j] = '.';
            h_count++;
        }
    }

    // output
    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            cout << grid[i][j];
        }
        cout << endl;
    }
    return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

ll dp1[202020] = {0};
ll dp1sum[202020] = {0};
ll dp2[202020] = {0};
ll dp2sum[202020] = {0};
ll P = 1000000007;
ll po10[202020] = {0};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;

  int n = s.size();
  po10[0] = 1;
  for (int i = 0; i < n; i++) {
    po10[i + 1] = (po10[i] * 10) % P;
  }

  dp1[0] = 1;
  dp2[0] = 0;
  for (int i2 = 0; i2 < n; i2++) {
    int i = n - i2 - 1;
    for (int j = '0'; j <= '9'; j++) {
      if (t[i2] != '?' && t[i2] != j) continue;
      if (s[i2] == j) {
        dp1[i2 + 1] += dp1[i2];
        dp1[i2 + 1] %= P;
        dp1sum[i2 + 1] += (((j - '0') * po10[i] * dp1[i2]) % P + dp1sum[i2]) % P;
        dp1sum[i2 + 1] %= P;
        dp2[i2 + 1] += dp2[i2];
        dp2[i2 + 1] %= P;
        dp2sum[i2 + 1] += (((j - '0') * po10[i] * dp2[i2]) % P + dp2sum[i2]) % P;
        dp2sum[i2 + 1] %= P;
      } else if (s[i2] > j) {
        dp2[i2 + 1] += dp1[i2] + dp2[i2];
        dp2[i2 + 1] %= P;
        dp2sum[i2 + 1] += (((j - '0') * po10[i] * (dp1[i2] + dp2[i2])) % P + dp1sum[i2] + dp2sum[i2]) % P;
        dp2sum[i2 + 1] %= P;
      } else {
        dp2[i2 + 1] += dp2[i2];
        dp2[i2 + 1] %= P;
        dp2sum[i2 + 1] += (((j - '0') * po10[i] * dp2[i2]) % P + dp2sum[i2]) % P;
      }
    }
  }

  cout << (dp1sum[n] + dp2sum[n]) % P << endl;
  return 0;
}



Measured memory_bytes: 11348
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d",&a,&b);
  if(a > b){
    while(b != 0){
      c=a%b;
      a=b;
      b=c;
    }
    printf("%d\n",a);
  }else{
    while(a != 0){
      c=b%a;
      b=a;
      a=c;
    }
    printf("%d\n",b);
  }
  return 0;
}

Measured memory_bytes: 592
import math
import numpy as np
from operator import mul

A,B = map(int, input().split())
n = 0

for i in range(A,B+1):
    pl = [int(x) for x in list(str(i))]
    if pl[0] == pl[4] and pl[1] == pl[3]:
        n += 1
        
print(n)



Measured memory_bytes: 13012
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;

  //  int ret;
  //  if (b <= 0 and d <= 0) {
  //    ret = a * c;
  //  } else if (a >= 0 and d c >= 0) {
  //    ret = b * d;

  //  } else {
  //    ret = max(a*

  // }
  long long ret = max({a * c, a * d, b * c, b * d});
  cout << ret << endl;

  return 0;
}


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

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	puts((a+b)&1?"Borys":"Alice");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
constexpr double eps = 1e-6;
constexpr ll LINF = 100200300400500600ll;
constexpr int INF = 2*((1<<30)-1)+1;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
constexpr int dx[4] = {0,1,0,-1};
constexpr int dy[4] = {-1,0,1,0};
constexpr int mod = 1000000007;
#define Yes(ifeq) cout<<(( ifeq )? "Yes":"No")<<endl;

void Main(){
  int n,a,b;
  cin>>n>>a>>b;
  srep(i,a,b+1){
    if(i%n==0){
      cout<<"OK"<<endl;
      return;
    }
  }
  cout<<"NG"<<endl;
  return;
  
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc075_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int H, W;
  cin >> H >> W;

  vector<string> s(H);
  rep(i, H) { cin >> s[i]; }

  rep(h, H) rep(w, W) {
    if (s[h][w] == '#') continue;
    int minH = max(0, h - 1);
    int maxH = min(H - 1, h + 1);
    int minW = max(0, w - 1);
    int maxW = min(W - 1, w + 1);

    int cnt = 0;
    repi(i, minH, maxH + 1) {
      repi(j, minW, maxW + 1) {
        // printf("%d %d %c\n", i, j, s[i][j]);
        cnt += s[i][j] == '#';
      }
    }
    // printf("%d %d %d %d %d\n", minH, maxH, minW, maxW, cnt);
    s[h][w] = '0' + cnt;
  }

  rep(h, H) {
    rep(w, W) { cout << s[h][w]; }
    cout << endl;
  }
}

Measured memory_bytes: 256
/*solved by RAKIB JOY*/
#include<stdio.h>
#include<stdbool.h>
bool dislike[10];
int main()
{
    int n,k,a;
    scanf("%d%d",&n,&k);
    while(k--)
    {
        scanf("%d",&a);
        dislike[a]=true;

    }
    for(int i=n;;i++)
    {
       int maybe=i;
       bool ok=true;
       while(maybe)
       {
          int last_digit=maybe%10;
          if(dislike[last_digit])
          {
             ok=false;
             break;
          }
          maybe/=10;
       }
       if(ok)
       {
          printf("%d\n",i);
          return 0;
       }
    }
    return 0;

}


Measured memory_bytes: 1728
#include<stdio.h>

int main(){
  long n,d[2001],i,j,k,cnt=0;
  scanf("%ld",&n);
  for(i=0;i<n;i++){
  	scanf("%ld",&d[i]);
  }
  
  for(j=0;j<n-1;j++){
      for(k=j+1;k<n;k++){
        if(d[j]>d[k]){
        	long tmp=d[j];
          	d[j]=d[k];
            d[k]=tmp;
        }
      }
  }
  
  for(i=0;i<n-2;i++){
  	for(j=i+1;j<n-1;j++){
      for(k=j+1;k<n;k++){
        //printf("%ld %ld %ld\n",d[i],d[j],d[k]);
        if((d[i]+d[j])>d[k])	cnt++;
      }
    }
  }
  printf("%ld",cnt);
  return 0;
}


Measured memory_bytes: 128
n = int(input())
a = [int(i) for i in input().split()]
a = [(a[i], i) for i in range(n)]

a.sort()

ans = [0] * n

for i in range(n):
  ans[a[i][1]] = a[n//2 - (i >= n//2)][0]

print("\n".join(map(str, ans)))

Measured memory_bytes: 127052
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

enum DIST{
	LEFT,
	RIGHT,
};

struct Info{
	Info(int arg_x,int arg_line_num){
		x = arg_x;
		line_num = arg_line_num;
	}
	bool operator<(const struct Info &arg) const{
			return x > arg.x;
	};
	int x,line_num;
};

int main(){

	int n,m,tmp_x,tmp_line_num;

	scanf("%d %d",&n,&m);

	int** dp = new int*[n+1];
	for(int i = 1; i <= n; i++){
		dp[i] = new int[2];
		dp[i][LEFT] = 0;
		dp[i][RIGHT] = 0;
	}

	priority_queue<Info> Q;

	for(int i = 0; i < m; i++){
		scanf("%d %d",&tmp_x,&tmp_line_num);
		Q.push(Info(tmp_x,tmp_line_num));
	}

	while(!Q.empty()){
		dp[Q.top().line_num+1][RIGHT] = max(dp[Q.top().line_num+1][RIGHT],dp[Q.top().line_num][RIGHT]+1);
		dp[Q.top().line_num][LEFT] = max(dp[Q.top().line_num][LEFT],dp[Q.top().line_num+1][LEFT]+1);
		Q.pop();
	}

	printf("%d",dp[1][LEFT]+dp[1][RIGHT]+1);
	for(int i = 2; i <= n; i++){
		printf(" %d",dp[i][LEFT]+dp[i][RIGHT]+1);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 11156
a, b = map(int, input().split())
def solve():
    if a == 0:
        return 0
    elif a > 0:
        return 1
    else:
        if b >= 0:
            return 0
        else:
            if (b - a + 1) % 2 == 0:
                return 1
            else:
                return -1
ret = solve()
if ret == 1:
    print("Positive")
elif ret == 0:
    print("Zero")
else:
    print("Negative")


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    int m;
    for(int i=0;i*i<=n*2;i++){
        m = i;
    }
    if(!((2*n)%m == 0 && (2*n)/m-m == 1)){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    cout << m+1 << endl;
    inc(i, 0, m+1){
        cout << m;
        inc(j, 0, m){
            if(j < i){
                cout << " " << j*m - (j-1)*(j)/2 + 0 + (i-j);
            }else{
                cout << " " << i*m - (i-1)*(i)/2 + 1 + (j-i);
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	int k;
  scanf("%d",&k);
  ll sum = 0;
  for(int i = 1; i <=k; i++){
  	for(int j = 1; j <= k; j++){
    	for(int l = 1; l <= k; l++){
        	sum += gcd(gcd(i,j),l);
        }
    }
  }
  printf("%lld",sum);
}

Measured memory_bytes: 3772
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <unordered_set>
#include <map>
#include <set>
#include <unordered_map>
#include <climits>
#include <cmath>
#include <stack>
#include <string>
using namespace std ;
#define ll long long int 
#define IOS ios::sync_with_stdio(false)  ; cin.tie(0) ; cout.tie()  
#define MOD  1000000007  

int main()
{ 
   string s ; 
   cin>>s ; 
   if(s.length() < 4)
    {
       cout<<"No" ;
    return 0  ;     }
    if(s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I')
      cout<<"Yes" ;
    else
      cout<<"No"   ; 

return  0 ;  
}
  

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << (n - 1) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	const int mod = 1000000007;
	public void Solve(){
		int N = ri();

		string ans = "No";
		int zoroCnt = 0;
		int[] Ds_old = ria();
		for (int i = 1; i < N; i++)
		{
			int[] Ds = ria();

			if(Ds[0] == Ds[1] && Ds_old[0] == Ds_old[1]) zoroCnt++;
			else zoroCnt = 0;

			if(zoroCnt > 1) 
			{
				ans = "Yes";
			}

			Ds_old = Ds;
		}

		Console.WriteLine(ans);
		Console.ReadLine();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static BigInteger rb(){return BigInteger.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
	static BigInteger[] rba(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>BigInteger.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


Measured memory_bytes: 27352
#define DEBUG 0

/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-26 21:05:46
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, M;
int k[100];
int s[100][100];
int p[100];

int main()
{
  cin >> N >> M;
  for (auto i = 0; i < M; i++)
  {
    cin >> k[i];
    for (auto j = 0; j < k[i]; j++)
    {
      cin >> s[i][j];
      s[i][j]--;
    }
  }
  for (auto i = 0; i < M; i++)
  {
    cin >> p[i];
  }
  int ans = 0;
  for (auto i = 0; i < (1 << N); i++)
  {
    bool ok = true;
    for (auto j = 0; j < M; j++)
    {
      int cnt = 0;
      for (auto l = 0; l < k[j]; l++)
      {
        if ((i >> s[j][l]) & 1)
        {
          cnt++;
        }
      }
      if (cnt % 2 != p[j])
      {
        ok = false;
        break;
      }
    }
    if (ok)
    {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<ll>p;
int liczbap[2569];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	for(int i=2;i<2501;i++) {
		if (liczbap[i]==0){
			p.push_back(i);
			for(int j =i+i;j<2501;j+=i){
				liczbap[j]=1;
			}
		}
	}
	map<ll,ll>	m;
	ll pod=1,prze=1;
	int licz=0;
	ll tabpod[n],tabprzed[n];
	for(int i=0;i<n;i++) {
		ll a;
		cin>>a;
		ll li=a;
		pod=1,prze=1;
		for(int j=0;j<p.size();j++) {
			licz=0;
			
			//cout<<p[j]<<" P"<<endl;
			
			while (li%p[j]==0) {
			//	cout<< "jddd"<<endl;
				  li/=p[j];
				  licz++;
			  }
			  if ( licz%3==1) {
				  pod*=p[j];
				  prze*=p[j]*p[j];
			  }
			  if ( licz%3==2) {
				  pod*=p[j]*p[j];
				  prze*=p[j];
			  }
		  }
	  
	  pod*=li;
	  ll pier=sqrt(li);
	 
	  if ( li== pier*pier){
		  prze*=pier;
	  }
	  else{
		  prze*=li*li;
	  }
	  tabpod[i]=pod;
	  tabprzed[i]=prze;
	  m[pod]++;
	//  cout<<pod<< " v "<<prze<<endl;	
  }
  int czyjed=0;
  ll odp=0;
  for(int i=0;i<n;i++) {
	  if ( tabpod[i]==1 ) { 	  	  			  
			 if ( !czyjed) {
				odp++;
				czyjed=1;
				continue;
			}else{
				continue;
			}
		}
		else{
		//	cout<<m[tabpod[i]]<<" "<< p[tabprzed[i]]<<endl;  
			odp+=max(m[tabpod[i]],m[tabprzed[i]]);
			m[tabpod[i]]=0;
			m[tabprzed[i]]=0;	
		}
	}
	cout<<odp;
}
			
			  
	


Measured memory_bytes: 14336
N = gets.to_i
T = gets.split.map(&:to_i)
M = gets.to_i
PX = M.times.map{gets.split.map(&:to_i)}

PX.each do |px|
    ans = T.dup
    index = px[0]
    ans[index -1] = px[1]
    puts ans.inject(:+)
end

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

int main(){
    int N, count=0;
    string str;
    cin >> N >> str;
    for(int code=0;code<1000;code++){
        string str_code = to_string(code);
        if(str_code.size()==1) str_code = "0" + str_code;
        if(str_code.size()==2) str_code = "0" + str_code;
        int id = 0;
        for(int i=0;i<str.size();i++) {
            if(str_code[id]==str[i]) {
                if(id==2) {
                    count++;
                    break;
                }
                else {
                    id++;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;

typedef int long long;

const int q = 10000000000 + 7;

int main() {
	
	int n;
	cin >> n;
	int length = int(log10(n)) + 1;
	int s = 0;
	for (int i = 1; i < length; i++)
	{
		if (i % 2 != 0) {
			s += 9 * pow(10, i-1);
		}
	}
	if (length % 2 != 0) {
		s += n - pow(10, length - 1) + 1;
	}
	cout << s << endl;
	
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
A = [0]*N

for i in range(N):
    #各文字列に番号A[i]を与える
    string = input()
    flag = True
    for j in range(10):
        A[i]+=10**(ord(string[j])-ord('a'))
        if(j<9):
            if(string[j]!=string[j+1]):
                flag = False
    if flag:
        A[i] = (ord(string[0])-ord('a')+1)*(-1)
    
C = Counter(A)
ans=0

for i in C.values():
    if i==1:
        continue
    ans+=i*(i-1)//2

print(ans)

Measured memory_bytes: 72648
#include <bits/stdc++.h>
#define N (long long)(998244353)
#define MAX 500000
using namespace std;

long long factorial[MAX] = {0}, finverse[MAX] = {0},
          inverse[MAX] = {0};

void smodfact() {
  factorial[0] = factorial[1] = 1;
  finverse[0] = finverse[1] = 1;
  inverse[1] = 1;
  for(int i = 2; i < MAX; ++i) {
    factorial[i] = factorial[i - 1] * i % N;
    inverse[i] = N - (inverse[N % i] * (N / i)) % N;
    finverse[i] = finverse[i - 1] * inverse[i] % N;
  }
}

long long calccomb(long long n, long long k) {
  if(n == k && n == 0) return 1;
  if(n < 0 || k < 0 || n < k) return 0;
  return factorial[n] * finverse[k] % N * finverse[n - k] %
         N;
}

long long n, k, a;
long long dp[200005] = {0}, sum[200005] = {0};

long long solve();

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

long long solve() {
  smodfact();
  for(int i = 0; i <= n; ++i)
    dp[k + i] = 100 * inverse[a] % N;
  a *= inverse[100];
  a %= N;
  sum[k] = n;
  for(int i = k - 1; i >= 0; --i) {
    dp[i] = sum[i + 1] * inverse[n] % N;
    sum[i] = sum[i + 1] + dp[i] * a % N;
    sum[i] %= N;
    sum[i] -= dp[i + n] * a % N;
    sum[i] += N;
    sum[i] %= N;
  }
  return dp[0];
}


Measured memory_bytes: 17188
#include<stdio.h>
 int main(void){
 int m,f,r;
 while(1){
 scanf("%d %d %d",&m,&f,&r);
 if(m==-1 && f==-1 && r==-1) break;

 if(m==-1 || f==-1){
 	printf("F\n");
 }
 else if(m+f<30){
	printf("F\n");
 }
 else if(m+f<50 && r>=50){
	printf("C\n");
 }
 else if(m+f<50 && r<50){
	printf("D\n");
 }
 else if(m+f<65){
	printf("C\n");
 }
 else if(m+f<80){
	printf("B\n");
 }
 else if(m+f>=80){
	printf("A\n");
 }
 }
 return (0);
 }



Measured memory_bytes: 2144
def main():
    s = input()
    items = s.split()
    A = int(items[0])
    B = int(items[1])
    K = int(items[2])

    if K <= A:
        print(A - K, B)
    elif K <= A + B:
        print(0, B - (K - A))
    else:
        print(0, 0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
A = list(input().split())
#print(A)
stack = list()
ans = 0
x = 0

for i in range(len(A)):
    if (A[i] == "+"):
        l = len(stack)
        x = stack[l-2] + stack[l-1]
        del stack[-1]
        del stack[-1]
        stack.append(x)

    elif (A[i] == "-"):
        l = len(stack)
        x = stack[l-2] - stack[l-1]
        del stack[-1]
        del stack[-1]
        stack.append(x)

    elif (A[i] == "*"):
        l = len(stack)
        x = stack[l-2] * stack[l-1]
        del stack[-1]
        del stack[-1]
        stack.append(x)

    elif (A[i] == "/"):
        l = len(stack)
        x = stack[l-2] / stack[l-1]
        del stack[-1]
        del stack[-1]
        stack.append(x)

    else :
        stack.append(int(A[i]))
print(stack[0])



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

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

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    int N,M; cin >> N >> M;
    int s[M],c[M];
    for(int i=0;i<M;i++){
        cin >> s[i] >> c[i];
    }
    for(int i=0;i<1000;i++){
        bool flag=true;
        string res=to_string(i);
        if(res.size()!=N) continue;
        for(int j=0;j<M;j++){
            if(res[s[j]-1]!=c[j]+'0'){
                flag=false;
                break;
            }
        }
        if(flag){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3652
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

//////////////////////////



int main(){fastio
    ll n,s;cin>>n>>s;
    ll a[n+1];rep(i,1,n)cin>>a[i];
    ll dp[n+1][s+1];memset(dp,0,sizeof(dp));
    rep(i,0,n)dp[i][0]=1;
    rep(i,1,n){
        
        rep(j,1,s){
            Add(dp[i][j],dp[i-1][j]);
            if(j-a[i]>=1)Add(dp[i][j],dp[i-1][j-a[i]]);
        }
        if(a[i]<=s)Add(dp[i][a[i]],mod(i*dp[i-1][0]));
    }
    /*
    rep(i,0,n){
        rep(j,0,s)cout<<dp[i][j]<<" ";
        cout<<endl;
    }*/
    
    ll ans=0;
    rep(i,1,n){
        //Add(ans,mod(dp[i][s]*(n+1-i)));
        Add(ans,dp[i][s]);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 70656