akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;


//---------------------------------------------------------------
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& os, const ModInt<MOD>& mi) { return os << mi.get(); }
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
template<typename T, int FAC_MAX> struct Comb { vector<T> fac, ifac;
    Comb() { fac.resize(FAC_MAX + 1, 1); ifac.resize(FAC_MAX + 1, 1);
        for (int i = 1; i <= FAC_MAX; i++) fac[i] = fac[i - 1] * i;
        for (int i = 1; i <= FAC_MAX; i++) ifac[i] = T(1) / fac[i]; }
    T aPb(int a, int b) { if (b < 0 || a < b) return T(0); return fac[a] * ifac[a - b]; }
    T aCb(int a, int b) { if (b < 0 || a < b) return T(0); return fac[a] * ifac[a - b] * ifac[b]; }
    T nHk(int n, int k) { if (n == 0 && k == 0) return T(1); if (n <= 0 || k < 0) return 0;
        return aCb(n + k - 1, k); }
    T fact(int n) { if (n < 0) return T(0); return fac[n]; }
};
typedef ModInt<MOD> mint;
//---------------------------------------------------------------


int main() {
    Comb<mint, 100001> com;
    int n; cin >> n;
    vector<int> a(n + 1);
    for (int i = 0; i <= n; i++) cin >> a[i], a[i]--;

    vector<int> id(n, -1);
    int l, r;
    for (int i = 0; i <= n; i++) {
        if (id[a[i]] == -1) {
            id[a[i]] = i;
        } else {
            l = id[a[i]], r = i;
        }
    }

    for (int k = 1; k <= n + 1; k++) {
        mint ans = 0;
        ans += com.aCb(n-1, k);
        ans += com.aCb(l+n-r, k-1);
        ans += mint(2) * (com.aCb(n-1, k-1) - com.aCb(l+n-r, k-1));
        ans += com.aCb(n-1, k-2);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vi a(n);
    ll ans = 0;
    map<int,int> m;
    rep(i,n){
        cin >> a[i];
        int x = a[i]-1;
        if(i-x-1 < 0) continue;
        else m[i-x-1]++;
    }
    rep(i,n){
        int x = a[i]-1;
        ans += m[i+x+1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14132
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
#define MOD int(1e9 + 7)

int main()
{
    long long N;
    cin >> N;
    cout << N / 3 << endl;
}

Measured memory_bytes: 256
// 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:usize,a:i64,b:i64,
        xs:[i64;n]
    }

    let mut ans = 0;
    for i in 0..n - 1 {
        let walk = ((xs[i] - xs[i + 1]).abs()) * a;
        ans += min(walk, b);
    }

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


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

class Main {

    public static void main(final String args[]) throws IOException {
        Scanner input = new Scanner(System.in);
        int H1 = (input.nextInt());
        int M1 = (input.nextInt());
        int H2 = (input.nextInt());
        int M2 = (input.nextInt());
        int K = (input.nextInt());
        int wakeTime = (H2-H1)*60+(M2-M1);//minutes
        System.out.println(wakeTime - K);

    }

}


Measured memory_bytes: 35776
# -*- coding: utf-8 -*-

a, b = map(str, raw_input().split())
result = ''
if a == 'H':
    if b== 'H':
       	result = 'H'
    else:
	result = 'D'
else:
    if b=='H':
        result='D'
    else:
	result='H'

# 出力
print result


Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
int dp[100005];
int a[3000], n, k, mn;
bool calc(int m)
{

    if(dp[m] != -1)
        return dp[m];

    dp[m] = 0;
    if(m < mn) return 0;
    for (int i = 0; i < n; ++i) {
        if(a[i] <= m && !calc(m - a[i])) {
            dp[m] = 1;
            break;
        }
    }

    return dp[m];

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

    memset(dp, -1, sizeof(dp));

    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        mn = min(mn, a[i]);
    }

    cout << (calc(k)?"First":"Second") << endl;
    return 0;
}

Measured memory_bytes: 5376
from sys import stdin

n = int(stdin.readline().rstrip())
a, b, c = [[int(x) for x in stdin.readline().rstrip().split()]
           for _ in range(3)]
total = 0
for i in range(len(a)):
    total += b[a[i]-1]
    if (i != len(a) - 1) and (a[i + 1] - a[i] == 1):
        total += c[a[i] - 1]

print(total)


Measured memory_bytes: 3060
#CODE FESTIVAL 2016 qual A
"""
もし一周回せるなら回してコストを払う
そうでないなら何もせずに次のアルファベットへ
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
kijun = ord("a")
alpha = [i for i in range(kijun,kijun+26)]
mod = 26

s = readline().rstrip().decode('utf-8')
k = int(readline())

ans = []
for i in s:
    if i == "a":
        ans.append(i)
    elif i == "z":
        if k >= 1:
            ans.append("a")
            k -= 1
        else:
            ans.append(i)
    else:
        if k >= kijun+26 - ord(i):
            ans.append("a")
            k -= kijun+26 - ord(i)
        else:
            ans.append(i)
if k:
    ans[-1] = chr(kijun+(ord(ans[-1])-kijun+k)%mod)
print("".join(ans))

Measured memory_bytes: 46832
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#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>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
ll fact[N];
ll invfact[N];
ll inv[N];
void factorialsComputation()
{
    inv[0]=inv[1]=1;
    fact[0]=fact[1]=1;
    invfact[0]=invfact[1]=1;
    for(int i=2;i<N;i++)
    {
        inv[i]=(inv[mod%i]*(mod-mod/i))%mod;
        fact[i]=(fact[i-1]*i)%mod;
        invfact[i]=(invfact[i-1]*inv[i])%mod;
    }
}
ll ncr(ll n,ll r)
{
    ll ans=fact[n]*invfact[r];
    ans%=mod;
    ans*=invfact[n-r];
    ans%=mod;
    return ans;
}
void solve()
{
    ll s;
    cin>>s;
    ll ans=0;
    for(int len=1;len<=2000;len++)
    {
        ll now=(s-3*len);
        if(now<0)
            break;
        ans+=(ncr(now+len-1,len-1));
        ans%=mod;
    }
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    factorialsComputation();
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 27236
#include"bits/stdc++.h"
#include"math.h"
using namespace std;

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

using ll = long long int;
using ld = long double;
using pii = pair<int,int>;

#define REP(i,m,n) for(ll i = m; i < (ll)(n);++i)
#define rep(i,n) REP(i,0,n)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
 
using vi=vc<int>;

const ll mod=1e9+7;
const ll INF = 1e18;
const int MAX = 700000;
const int MOD = 1000000007;


long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

  
  int main(){
    string s[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string d;cin >> d;
    rep(i,7)if(d==s[i]){
      cout << 7-i << endl;}
  }

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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;}

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

  ll x, y, ans=1e18;
  cin >> x >> y;

  if(x <= y) ans = min(y-x, ans);
  if(-x <= y) ans = min(x+y+1, ans);
  if(x <= -y) ans = min(-y-x+1, ans);
  if(-x <= -y) ans = min(-y+x+2, ans);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val hList = readLine()!!.split(" ").map { it.toInt() }

  var dp = mutableMapOf<Int, Int>()
  dp[0] = 0
  dp[1] = Math.abs(hList[0] - hList[1])

  for (i in 2 until hList.size) {
    val h = hList[i]
    val d0 = Math.abs(h - hList[i - 2]!!) + dp[i - 2]!!
    val d1 = Math.abs(h - hList[i - 1]!!) + dp[i - 1]!!
    dp[i] = Math.min(d0, d1)
  }

  println(dp[n - 1])

}



Measured memory_bytes: 62252
#include<iostream>
using namespace std;
int main(){
    int a,b,t;
    cin >> a >> b;
    t=a+b;
    if(a-b>t)
    	t=a-b;
    if(a*b>t)
    	t=a*b;
    cout << t << endl;
    return 0;
}

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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


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

  map<lint,lint> mp;
  for(lint i=0;i<n;i++) {
    mp[a[i]]++;
    mp[a[i]+1]++;
    mp[a[i]-1]++;
  }

  lint ans=0;
  for(map<lint,lint>::iterator itr=mp.begin();itr!=mp.end();itr++) { ans = max(ans,itr->second); }

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


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

int main(){
    int a, b;
    char op;
    
    while(1){
        cin >> a >> op >> b;
        if ( op == '?' ) break;
        
        if ( op == '+' ) cout << a + b << endl;
        else if ( op == '-' ) cout << a - b << endl;
        else if ( op == '*' ) cout << a * b << endl;
        else if ( op == '/' ) cout << a / b << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3080
import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int N = sc.nextInt();
    int dp[] = new int[N+10];
    for(int i=1; i<=N; i++){
      int tmp = dp[i-1] + 1;
      int k = 6;
      while(i-k >= 0){
        tmp = Math.min(tmp, dp[i-k]+1);
        k *= 6;
      }
      k = 9;
      while(i-k >= 0){
        tmp = Math.min(tmp, dp[i-k]+1);
        k *= 9;
      }
      dp[i] = tmp;
    }
    out.println(dp[N]);      
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 21460
#include <stdio.h>

int main(void){
	int h, w;
	int i, j;
	
	while(1){	
	scanf("%d", &h);
	scanf("%d", &w);

		if(h == 0 && w == 0){
			break;
		}

		for(i = 0; i < h; i++){
			for(j = 0; j < w; j++){
				printf("#");
			}
			printf("\n");
		}

		printf("\n");
	}

	return 0;
}

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

const int mod=1e9+7;

int pw(int a,int t){
    int x=1;
    while(t){
        if(t&1)x=x*a%mod;
        a=a*a%mod,t>>=1;
    }
    return x;
}
int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int n,z=0;
    cin >> n;
    map <pair <int,int>,int> m;
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        if(a==0 and b==0){
            z++;
            continue;
        }
        if(b<0)b=-b,a=-a;
        int g=__gcd(abs(a),abs(b));
        a/=g,b/=g;
        if(a==0 or b==0)a=abs(a),b=abs(b);
        m[{a,b}]++;
    }
    int ans=1;
    for(auto i:m){
        int a=i.first.first,b=i.first.second;
        if(i.second==0)continue;
        int na=-b,nb=a;
        if(a<0)na=-na,nb=-nb;
        if(na==0 or nb==0)na=abs(na),nb=abs(nb);
        int x=i.second,y=m[{na,nb}];
        m[{na,nb}]=0;
        int r=(pw(2,x)+pw(2,y)-1+mod)%mod;
        ans=(ans*r)%mod;
    }
    cout << (ans+mod-1+z)%mod;
}

Measured memory_bytes: 28620
#include <iostream>

using namespace std;

void afisare(int a, int b, int c, int d, int i, int j, int k)
{
    cout << a;
    if (i == 1) cout << "+";
    else cout << "-";
    cout << b;
    if (j == 1) cout << "+";
    else cout << "-";
    cout << c;
    if (k == 1) cout << "+";
    else cout << "-";
    cout << d;
    cout << "=7";
}

int main()
{
    int a, b, c, d, res;
    string s;
    cin >> s;
    a = s[0] - 48;
    b = s[1] - 48;
    c = s[2] - 48;
    d = s[3] - 48;
    res = 7;
    for (int i = 1; i <= 2; ++i) {
        int nr = 0;
        for (int j = 1; j <= 2; ++j)
            for (int k = 1; k <= 2; ++k) {
                if (i == 1)
                    nr = a + b;
                if (i == 2)
                    nr = a - b;
                if (j == 1)
                    nr += c;
                if (j == 2)
                    nr -= c;
                if (k == 1)
                    nr += d;
                if (k == 2)
                    nr -= d;
                if (nr == res) {
                    afisare(a, b, c, d, i, j, k);
                    return 0;
                }
            }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n, k, tmp;
    set<int> d;
    cin >> n >> k;
    rep(i, k){
        cin >> tmp;
        d.insert(tmp);
    }

    int t = 10;
    int ke = keta(n);
    while(t <= pow(10, ke)){
        int num = n%t / (t/10);
        //cout << num << " " << t << endl;
        if(d.find(num) != d.end()){
            //n += t/10;
            n++;
            t = 10;
        }else{
            t *= 10;
        }
        ke = keta(n);
    }

    cout << n << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma region template

#include <bits/stdc++.h>
using namespace std;

#pragma region random

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> T randint(T a, T b) {
    return uniform_int_distribution<T>(a, b)(rng);
}

#pragma endregion

#pragma region debug
string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A> string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first)
            res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

#pragma endregion

#pragma endregion

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
cin>>n;
vector<int> dp(n),height(n);
for(int i=0;i<n;i++)
cin>>height[i];
dp[0] = 0;
dp[1] = abs(height[1] - height[0]);
for(int i=2;i<n;i++)
{
dp[i] = min(dp[i-2]+abs(height[i]-height[i-2]),dp[i-1]+abs(height[i]-height[i-1]));
}
//debug(dp);
cout<<dp[n-1];

return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
//#include <string.h>

int main() {
    int n, i, val, min, max;
    long sum = 0;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &val);

        if (i == 0) {
            min = val;
            max = val;
        }

        sum += val;

        if (val < min)
            min = val;
        if (val > max)
            max = val;
    }

    printf("%d %d %ld\n", min, max, sum);

    return 0;
}


Measured memory_bytes: 2076
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mx INT_MAX
#define mn INT_MIN
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define itr set<int> :: iterator
const int mod = 1e9+7;

vector<ll> a;
ll dp[101][100001];

int main(){

    // ******* START HERE ******
    
    int n,k;
    cin>>n>>k;

    a.clear();
    for(int i=0; i<n; i++){
      ll x;
      cin>>x;
      a.pb(x);
    }
    
    dp[0][0] = 1;
    for(int i=1; i<=k; i++)
      dp[0][i] = 0;

    for(int i=1; i<=n; i++){
       vector<ll> sum(k+1);
       sum[0] = dp[i-1][0];

       for(int j=1; j<=k; j++)
          sum[j] = ( sum[j-1] + dp[i-1][j] )%mod;

       for(int j=0; j<=k; j++){
          if( j <= a[i-1] )
            dp[i][j] = sum[j];
          else{
            dp[i][j] = ( sum[j]-sum[j-a[i-1]-1]+mod )%mod;
          }
       }
       sum.clear();
    }
    
    cout<<dp[n][k]<<endl;
    // ***** END HERE ***** 
    return 0;
}

Measured memory_bytes: 83204
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0){
                break;
            }else{
                for(int i = 0; i < H; i++){
                    for(int n = 0; n < W; n++){
                        System.out.print("#");
                    }
                    System.out.println("");
                }
                System.out.println("");
            }
        }
    }
}



Measured memory_bytes: 37200
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#include <set> 
 
using namespace std;
 
#define int long long
#define val(x) cout << #x << " equals to " << x << endl
 
const int N = 2e6 + 7;
const int INF = 1e18;

int n, m, k, q, a[N];

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    #ifdef LOCAL
        freopen("C:/Users/emrey/Code/in.txt", "r", stdin);
    #endif

    int T; cin >> T;
    cout << (1000 - (T % 1000)) % 1000;

}

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

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i, n) cin >> p[i];
	vector<int> a(n), b(n), r(n);
	rep(i, n) {
		a[i] = 30000 * (i + 1);
		b[i] = 30000 * (n - i);
		r[p[i]-1] = i + 1;
	}
	rep(i, n) {
		if (i != 0) cout << " ";
		cout << a[i];
	}
	cout << endl;
	rep(i, n) {
		if (i != 0) cout << " ";
		cout << b[i] + r[i];
	}
	cout << endl;
}


Measured memory_bytes: 896
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}
int main()
{
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}


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

int main(void) {
    string s;
    int ans= 0;
    cin >> s;
    for(int i=0;i<s.size();i++) {
        if(s[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=114514;
char st[N];
int p[114514];
int main()
{
    scanf("%s",st+1);
    int n=strlen(st+1);
    for(int i=1;i<=n;i++)p[st[i]]=1;
    if(p['E']!=p['W']||p['N']!=p['S'])puts("No");
    else puts("Yes");
}

Measured memory_bytes: 3700
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner stdin = new Scanner(new BufferedInputStream(System.in));
		List<String> output = new ArrayList<String>();
		while (stdin.hasNext()) {
			String input = stdin.nextLine();
			String[] inputs = input.split(" ");
			int h = Integer.parseInt(inputs[0]);
			int w = Integer.parseInt(inputs[1]);
			if (h == 0 && w == 0) {
				break;
			} else {
				if (h >= 1 && h <= 300 && w >= 1 && w <= 300) {
                    for (int i = 1; i <= h; i++) {
                        String result = "";
                        for (int j = 1; j <= w; j++) {
                            result += "#";
                        }
                        output.add(result);
                    }
                    output.add("");
				}
			}
		}
		for (String out : output) {
            System.out.println(out);
        }


	}

}

Measured memory_bytes: 54368
#include<bits/stdc++.h>
using namespace std;
typedef tuple<int,int,int>T;
typedef vector<T>VT;
int main(void){
	int v,e;
	int s,t,w;
	VT vt;
	T tt;
	int par[10001],ran[10001];
	int x,y;
	int sum;
	int i,j;
	cin>>v>>e;
	for(i=0;i<e;i++){
		cin>>s>>t>>w;
		get<0>(tt)=w;
		get<1>(tt)=s;
		get<2>(tt)=t;
		vt.push_back(tt);
	}
	sort(vt.begin(),vt.end());
	for(i=0;i<v;i++){
		par[i]=i;
		ran[i]=0;
	}
	sum=0;
	for(i=0;i<e;i++){
		x=get<1>(vt[i]);
		y=get<2>(vt[i]);
		while(x!=par[x])	x=par[x];
		while(y!=par[y])	y=par[y];
		if(x!=y){
			if		(ran[x]<ran[y])	par[x]=y;
			else if	(ran[x]>ran[y])	par[y]=x;
			else{	
				par[x]=y;
				ran[y]++;
			}
			sum+=get<0>(vt[i]);
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 4524
import java.util.*;

public class Main {
    private static final int MAX = 1_299_710;
    private static final boolean[] PRIME;

    static {
        boolean[] ary = new boolean[MAX];
        Arrays.fill(ary, 2, ary.length, true);
        for(int i = 4; i < MAX; i += 2) {
            ary[i] = false;
        }
        int lmt = (int)Math.ceil(Math.sqrt(MAX));
        for(int i = 3; i < lmt; i += 2) {
            if(ary[i]) {
                for(int j = i * 2; j < MAX; j += i) {
                    ary[j] = false;
                }
            }
        }
        PRIME = ary;
    }

    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int num;
            while((num = scn.nextInt()) > 1) {
                System.out.println(PRIME[num] ? 0 : countGap(num));
            }
        }
    }

    private static int countGap(int num) {
        int rslt = 0;
        for(int i = num; !PRIME[i]; i++) {
            rslt++;
        }
        for(int i = num; !PRIME[i]; i--) {
            rslt++;
        }
        return rslt;
    }
}

Measured memory_bytes: 32356
#include<stdio.h>
#define N_MAX 30
#define M_MAX 30

int main(){
  int N,M;
  int result[M_MAX] = {0};

  scanf("%d %d", &N, &M);

  for(int i = 0; i < N; i ++){
    int k;
    scanf("%d", &k);
    for(int j = 0; j < k; j ++){
      int a;
      scanf("%d", &a);
      result[a-1] ++;
    }
  }

  int ans = 0;
  for(int i = 0; i < M; i ++){
    ans += (result[i] == N);
  }
  printf("%d", ans);
  return 0;
}

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

int main()
{
	while (1)
	{
		int H, W;
		cin >> H >> W;

		if (H == 0 && W == 0)break;
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

#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;

void solve(long long K)
{
    ll ans = 0;
    rep1(i, K + 1)
    {
        rep1(j, K + 1)
        {
            rep1(k, K + 1) { ans += gcd(i, gcd(j, k)); }
        }
    }
    cout << ans << endl;
}

int main()
{
    long long K;
    scanf("%lld", &K);
    solve(K);
    return 0;
}


Measured memory_bytes: 3660
# N, L = 3, 3
# SRR = [
#     "dxx",
#     "axx",
#     "cxx"
# ]

N, L = map(int,input().split())
SRR = []

for i in range(N):
    SRR.append(input())


srr2 = sorted(SRR)


result = "".join(srr2)

print(result)




Measured memory_bytes: 9024
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;

int n,k,c,a[N],b[N];
string s;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k>>c>>s; 
	int cnt=0;
	for(int i=0;i<s.size()&&cnt<k;i++){
		if(s[i]=='o'){
			cnt++;
			a[i]=cnt;
			i+=c;
		}
	}
	cnt=0;
	for(int i=s.size()-1;i>=0&&cnt<k;i--){
		if(s[i]=='o'){
			cnt++;
			b[i]=cnt;
			i-=c;
		}
	}
	for(int i=0;i<s.size();i++){
		if(a[i]!=0&&b[i]!=0&&a[i]+b[i]==k+1) cout<<i+1<<'\n';
	}
	return 0;
}


Measured memory_bytes: 5264
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int x = Integer.parseInt(br.readLine());
            int i = 1;
            int temp = 0;
            int min = 0;
            int max = 0;
            while (true) {
                temp += i;
                min = -1 * temp;
                max = temp;
                if (min <= min && x <= max) {
                    System.out.println(i);
                    break;
                }
                i++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 21204
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, arr[100010], dif[100010];

int mcd(int a, int b){
    //printf("%d %d\n", a, b);
    if(a == 0 ){
        return b;
    }
    if(b == 0){
        return a;
    }
    int mod = b%a;
    mcd(mod, a);
}

int main(){
    scanf("%d", &n);
    scanf("%d", &arr[0]);
    for(int i=0; i<n; i++){
        scanf("%d", &arr[i+1]);
    }
    sort(arr, arr+n+1);
    int better=arr[1]-arr[0];


    for(int i=1; i<= n; i++){
        better = mcd(better, arr[i]-arr[i-1]);
    }
    //int d = arr[1] - arr[0];
    printf("%d\n", better);
}


Measured memory_bytes: 512
import java.util.*;
 
public class Main {
 
    long INF = Long.MAX_VALUE;
 
    public static void main(String[] args) {
        new Main().solve();
    }
 
    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] pc = new int[N + 1];
        long[] P = new long[M];
        long[][] Y = new long[M][3];
        Arrays.fill(pc, 0);
        for (int i = 0; i < M; i++) {
            P[i] = sc.nextLong();
            Y[i][0] = sc.nextLong();
            Y[i][1] = i;
            Y[i][2] = P[i];
        }
        Arrays.sort(Y, (a, b) -> Long.compare(a[0], b[0]));
        for (int i = 0; i < M; i++) {
            pc[(int) Y[i][2]]++;
            Y[i][0] = pc[(int) Y[i][2]];
        }
        Arrays.sort(Y, (a, b) -> Long.compare(a[1], b[1]));
        for (int i = 0; i < M; i++) {
            if (String.valueOf(P[i]).length() == 2) {
                System.out.print("0000");
            } else if (String.valueOf(P[i]).length() == 3) {
                System.out.print("000");
            } else if (String.valueOf(P[i]).length() == 4) {
                System.out.print("00");
            } else if (String.valueOf(P[i]).length() == 5) {
                System.out.print("0");
            } else if (String.valueOf(P[i]).length() == 1) {
                System.out.print("00000");
            }
            System.out.println(P[i] * 1000000 + Y[i][0]);
        }
    }
}

Measured memory_bytes: 104972
# ABC 118: B – Foods Loved by Everyone
n, m = [int(s) for s in input().split()]

k = []
a = []

for _ in range(n):
    tmp = [int(s) for s in input().split()]
    k.append(tmp[0])
    a.append(tmp[1:])

foods = [0] * m

for i in range(n):
    for j in range(m):
        if j + 1 in a[i]:
            foods[j] += 1

print(foods.count(n))

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int>a(m*2);
  for(int i = 0; i<2*m; i++) cin >> a.at(i);
  vector<int>res(100);
  for(int i = 0; i<n; i++) res.at(i) = 0;
  for(int i = 0; i<2*m; i++){
    res.at(a.at(i))++;
  }
  for(int i = 1; i<=n; i++) cout << res.at(i) << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
int main() {
  string S;
  cin >> S;
  int n = S.size() - 1;
  if(S.at(n) == 's'){
    cout << S + "es" << endl;
  }else{
    cout << S + "s" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
using System;
using System.IO;

class Solve{
    static void Main(string[] args){
        Console.ReadLine();
        var A = Console.ReadLine().Split();
        var answer = 0;
        var or = 0;
        foreach(var str in A){
            var ai = int.Parse(str);
            if ((ai & 1) == 1){
                or = 0;
                break;}
            or |= ai;}
        if (or != 0){
            while ((or & 1) == 0){
                or >>= 1;
                answer++;}}
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 27616
#define _USE_MATH_DEFINES  // M_PI等のフラグ

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>
#include <list>

#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

string replace_with_str(string str, string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

void solve(){
    char c;
    cin >> c;
    cout << char(c+1) << endl;

    return;
}

int main(int argc, char const *argv[]){
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

double d;

int main()
{
	while(scanf("%lf",&d),d>=0)
	{
		if(d>=256)
		{
			puts("NA"); continue;
		}
		rep(i,7)d/=2;
		int a[12]={0};
		rep(i,12)
		{
			if(d>=1)a[i]=1,d-=1;
			d*=2;
		}
		if(d!=0)puts("NA");
		else
		{
			rep(i,8)printf("%d",a[i]);
			putchar('.');
			rep(i,4)printf("%d",a[i+8]);
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 0
import kotlin.math.sqrt
 
fun main() {
    val nmk = nextIntList()
    val ans = solve(nmk)
    println(ans)
}
 
fun solve(nmk: List<Int>): String {
    val n = nmk[0]
    val m = nmk[1]
    val k = nmk[2]
 
    val a = (1..n).flatMap { gyou ->
        (1..m).map { retu ->
            val b = gyou * m + retu * (n - gyou) - retu * gyou
            b
        }
    }
  
      val b = a.plus((1..m).map { it * n })

 
    return if(b.contains(k)) {
        "Yes"
    } else {
        "No"
    }
}
 
fun nextIntList(): List<Int> {
    return readLine()!!.split(" ").map { it.toInt() }
}

Measured memory_bytes: 86112
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    int n, t;
    int arr[7];
    for (; ;) {
        scanf("%d", &n);
        if (n == 0) break;
        fill(arr, arr+7, 0);
        for (int i = 0; i < n; i++) {
            scanf("%d", &t);
            t/=10;
            if (t >= 6) arr[6]++;
            else arr[t]++;
        }
        for (int i = 0; i<= 6; i++) printf("%d\n", arr[i]);

    }
    return 0;
}



Measured memory_bytes: 2676
p = 0
g = 0
S = list(input())
ans = 0
for i in range(len(S)):
    if S[i] == "g" and p < g:
        ans += 1
        p += 1
    elif S[i] == "g" and p == g:
        g += 1
    if S[i] == "p" and p < g:
        p += 1
    elif S[i] == "p" and p == g:
        ans -= 1
        g += 1
print(ans)


Measured memory_bytes: 9892
// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        long N = sc.nextLong();
        String text = sc.next();

        StringBuffer sb = new StringBuffer(text);

        for (int i = 0; i < text.length(); i++) {
            char ch = text.charAt(i);
            sb.setCharAt(i, ch + N > 'Z' ? (char) (ch + N - ('Z' - 'A') - 1) : (char) (ch + N));
        }

        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 22612
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C


def get_candidate_points(sorted_a_b: list, c: int, d: int) -> list:
    candidate_a_b = [x for x in sorted_a_b if (x[0] < c) and (x[1] < d)]
    return sorted(candidate_a_b, key=lambda x: (x[1], x[0]), reverse=True)


if __name__ == '__main__':
    number = int(input())

    a_b = [list(map(int, input().split())) for _ in range(number)]
    c_d = [list(map(int, input().split())) for _ in range(number)]
    sorted_a_b = sorted(a_b, key=lambda x: (x[0], x[1]))
    sorted_c_d = sorted(c_d, key=lambda y: (y[0], y[1]))
    count = 0

    for c, d in sorted_c_d:
        points = get_candidate_points(sorted_a_b, c, d)

        if len(points) >= 1:
            sorted_a_b.remove(points[0])
            count += 1

    print(count)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define MAX 100
#define white 0
#define gray 1
#define black 2
#define INFTY (1 << 21)

int n,M[MAX][MAX];

void route(){
    int minv,d[MAX],color[MAX];
    
    for(int i = 0;i < n;i++){
        d[i] = INFTY;
        color[i] = white;
    }
    
    d[0] = 0;
    color[0] = gray;
    while(1){
        minv = INFTY;
        int u = -1;
        for(int i = 0;i < n;i++){
            if(minv > d[i]&&color[i] != black){
                u = i;
                minv = d[i];
            }
        }
        if(u == -1)break;
        color[u] = black;
        for(int v = 0;v < n;v++){
            if(color[v] != black&&M[u][v] != INFTY){
                if(d[v] > d[u] + M[u][v]){
                    d[v] = d[u] + M[u][v];
                    color[v] = gray;
                }
            }
        }
    }
    for(int i = 0;i < n;i++){
        cout << i << " " << (d[i] == INFTY ? -1: d[i]) << endl;
    }
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            M[i][j] = INFTY;
        }
    }
    
    int k,c,v,u;
    for(int i = 0;i < n;i++){
        cin >> u >> k;
        for(int j = 0;j < k;j++){
            cin >> v >> c;
            M[u][v] = c;
        }
    }
    route();
    return 0;
}


Measured memory_bytes: 3120
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, X: int, T: int):
    ans = N//X
    b = N%X
    if b!=0:
        ans += 1

    print(ans*T)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(N, X, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26988
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long
#define pb push_back

int n, x[200], f;
vector <int> a;

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	f = 0;
	cin >> n;
	for(int i = 0; i < n; ++i) cin >> x[i];
	sort(x, x+n);
	for(int p = x[0]; p < x[n-1]; ++p) {
		f = 0;
		for(int i = 0; i < n; ++i) {
			f += (x[i]-p)*(x[i]-p);
		}
		a.pb(f);
	}
	if (a.empty()) cout << 0;
	else cout << *min_element(a.begin(),a.end());
}

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

int main() {
    int N;
    int a[10000];

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

    int ans = 0;

    for (int i = 0; i < N; i++){
        int n = a[i];
        while (n % 2 == 0){
            ans += 1;
            n /= 2;
        }
    }

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

Measured memory_bytes: 380