akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    string s,t;
    cin >> s >> t;
    int ans = 0;
    rep(i,s.size()) {
        if(s[i]!=t[i]) ans++;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3920
import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.math.BigInteger;
public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
       int m=Integer.parseInt(st.nextToken());
if(n+m==15)
  System.out.println("+");
else if(n*m==15)
System.out.println("*");
else
System.out.println("x");
}
}

Measured memory_bytes: 21332
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    string s ;
    cin >> s ;
    int bgn = 0 ;
    int ed ;
    
    for(int i = 0 ; i < s.size(); i++){
        if(s[i] == 'A'&& bgn == 0){
            bgn = i + 1 ;
        }
        if(s[i] =='Z'){
            ed = i + 1 ;
        }
    }

    cout << ed - bgn +1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<climits>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
#define MAXN 100000
#define MAXM 100000
#define INF 1000000000000000
struct node
{
    int next,to;
    long long w;
}e[MAXM*2+5];
struct Qr
{
    int xr,dec;
    long long lim;
};
long long T;
int cnt,m,n;
int x,y,z,flag;
long long ri=INF,le=-INF;
long long vis[2][MAXN+5];
int b[MAXN+5];
void fpush(int u,int v,long long w)
{
    e[++cnt].next=b[u];
    e[cnt].w=w;
    e[cnt].to=v;
    b[u]=cnt;
}
int Ch(int x){if(x==-1)x=0;return x;}
void dfs(int xr,int dec,long long lim)
{
    if(flag)return ;
    for(int i=b[xr];i;i=e[i].next)
    {
        int xnext=e[i].to;
        long long nlim=e[i].w-lim;
        int FD=Ch(dec);
        if(vis[FD][xnext]!=INF)
        {
            if(vis[FD][xnext]!=nlim){flag=1;return ;}
            else continue;
        }
        vis[FD][xnext]=nlim;
        if(!FD)le=max(le,-vis[FD][xnext]);
        else ri=min(ri,vis[FD][xnext]);
        dfs(xnext,-dec,nlim);
    }
}
int main()
{
    fill(vis[0],vis[0]+MAXN+1,INF);
    fill(vis[1],vis[1]+MAXN+1,INF);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d%d",&x,&y,&z);
        fpush(x,y,z);fpush(y,x,z);
    }
    dfs(1,1,0);
    if(flag){printf("0\n");return 0;}
    long long T=-1;//
    for(int i=1;i<=n;i++)
        if(vis[0][i]!=INF&&vis[1][i]!=INF)
        {
            long long NT=(vis[1][i]-vis[0][i])/2;
            if(NT<0){flag=1;break;}
            if(T==-1)T=NT;
            else if(T!=NT){flag=1;break;}
        }
    if(flag){printf("0\n");return 0;}
    if(T!=-1)
    {
        if(T>le&&T<ri)printf("1\n");
        else printf("0\n");
    }
    else printf("%lld",max((long long)0,ri-le-1));
}

Measured memory_bytes: 15360
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <limits.h>
#include <assert.h>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long int
#define db double
#define ldb long double
#define MOD 1000000007
#define FI first
#define SE second
#define INF INT_MAX
#define NINF INT_MIN
#define L_INF LLONG_MAX
#define L_NINF LLONG_MIN
#define gc getchar
#define sz size

void fsscan()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void scan(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}

int main()
{
    //Write Your Code Here
    int n;
    cin>>n;
    cout<<24+24-n;
    return 0;
}



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

#define FOR(i, l, r) for(long long int i = l; i < r; i++)
#define rep(i, N) FOR(i, 0, N)

using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

    //素因数分解
    map<int,int> ret;
    int ntmp = n;
    for(int i = 2; i * i <= ntmp; i++) {
        while(ntmp % i == 0) {
            ret[i]++;
            ntmp /= i;
        }
    }
    if(ntmp != 1) ret[ntmp] = 1;

    printf("%d:", n);
    map<int, int>::iterator itr = ret.begin();
    while(itr != ret.end()){
        rep(i,itr->second){
            printf(" %d", itr->first);
        }
        itr++;
    }
    printf("\n", n);
    return 0;
}



Measured memory_bytes: 3216
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
int T[101010], A[101010];
int lo[101010], hi[101010];

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%lld", T + i);
	for (int i = 0; i < N; ++i) scanf("%lld", A + i);

	i64 ret = 1;
	for (int i = 0; i < N; ++i) {
		lo[i] = 0;
		hi[i] = T[N - 1];
	}
	int pre = 0;
	for (int i = 0; i < N; ++i) {
		if (pre > T[i]) {
			puts("0");
			return 0;
		}
	//	printf("%d %d\n", lo[i], hi[i]);
		if (pre == T[i]) {
			lo[i] = max(lo[i], 1);
			hi[i] = min(hi[i], T[i]);
		} else {
			lo[i] = max(lo[i], T[i]);
			hi[i] = min(hi[i], T[i]);
		}
	//	printf("%d %d\n", lo[i], hi[i]);
		pre = T[i];
	}
	pre = 0;
	for (int i = N - 1; i >= 0; --i) {
		if (pre > A[i]) {
			puts("0");
			return 0;
		}
		if (pre == A[i]) {
			lo[i] = max(lo[i], 1);
			hi[i] = min(hi[i], A[i]);
		} else {
			lo[i] = max(lo[i], A[i]);
			hi[i] = min(hi[i], A[i]);
		}
		pre = A[i];
	}
	for (int i = 0; i < N; ++i) {
		ret = ret * (i64)max(0, hi[i] - lo[i] + 1) % MOD;
	}
	printf("%lld\n", ret);
	return 0;
}


Measured memory_bytes: 1792
from sys import stdin
import numpy as np
n, k = map(int, stdin.buffer.readline().split())
a = np.fromstring(stdin.buffer.read(), dtype=np.int64, sep=' ')

ng = 0
ok = 10 ** 9 + 1
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if np.sum(np.ceil(a / mid) - 1) <= k:
        ok = mid
    else:
        ng = mid
print(ok)


Measured memory_bytes: 32160
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		ArrayList<String> list = new ArrayList<String>();
		for(int i = 0; i < N; i++) list.add(sc.next());
		list.sort((s1, s2)->s1.compareTo(s2));
		
		StringBuilder ans = new StringBuilder();
		for(String s : list) ans.append(s);
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    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());
    }
}

Measured memory_bytes: 28372
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll X;
    cin>>X;
    if(X==3||X==5||X==7)cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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 (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    cout << n*(n-1)/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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(b<a){a=b;return 1;}return 0;}

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<lint>a(n);
	rep(i,n)cin>>a[i];
	lint ans=1,max=pow(10,18);
	rep(i,n){
		if(ans==-1){
			if(a[i]==0)ans=0;
		}else{
			lint tmp=ans;
			ans*=a[i];
			if(max<ans){
				ans=-1;
			}
			if(a[i]!=0)if(ans/a[i]!=tmp)ans=-1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int cnt = 0;
  int mi = 10000000;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mi = min(mi, a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (mi == a[i]) cnt++;
  }
  cout << (n - cnt + k - 1 - 1) / (k - 1) << endl;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w; cin>>h>>w;
  vs G(h);
  rep(i,h) cin>>G[i];
  
  map<char,ll> m;
  rep(i,h) rep(j,w){
    char c=G[i][j];
    m[c]++;
  }
  
  vll v(4);
  for(auto e: m){
    ll c=e.second/4;
    v[0]+=c;
    ll mod=e.second%4;
    if(mod){
      if(mod==3){
        v[1]++;
        v[2]++;
      }else{
        v[mod]++;
      }
    }
  }
  
  if(h%2==0 && w%2==0){
    if(v[0]*4==h*w) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }else if(h%2 && w%2){
    if(v[1]!=1){
      cout<<"No"<<endl;
      return 0;
    }
    
    ll sum=(h-1)/2+(w-1)/2;
    if(v[2]<=sum && (sum-v[2])%2==0){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
    
  }else{
    if(v[1]!=0){
      cout<<"No"<<endl;
      return 0;
    }
    
    if(w%2) swap(h,w);
    ll sum=w/2;
    if(v[2]<=sum && (sum-v[2])%2==0){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
    
  }
  
}

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

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

using namespace std;

#define F first
#define S second
#define pb push_back
#define m_t make_tuple
#define m_p make_pair
#define mp make_pair

typedef long long ll;
typedef long double ld;


#define FILE "teleports"
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);
#else
//  freopen(FILE".in", "r", stdin);
//  freopen(FILE".out", "w", stdout);
#endif // LOCAL
  int n;
  cin >> n;
  int ans = 0;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; i++){
    if (i & 1){
      ans -= a[i];
    } else {
      ans += a[i];
    }
  }
  cout << ans << endl;
#ifdef LOCAL
  cerr << fixed << setprecision(10) << "TIME = " << 1.0 * clock() / CLOCKS_PER_SEC << '\n';
#endif // LOCAL
  return 0;
}


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

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

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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n:usize,
        m:usize,
        py: [(usize, u64);m],
    }
    let mut v:Vec<Vec<(u64, usize)>> = vec![vec![];n];
    for i in 0..m {
        v[py[i].0 - 1].push((py[i].1, i));
    }
    for i in 0..n {
        v[i].sort_by_key(|k| k.0);
    }
    let mut ans:Vec<(String, usize)> = Vec::new();
    for i in 0..n {
        let mut ind = 0;
        for &(_j, org) in &v[i] {
            ind+=1;
            ans.push((format!("{0:>06}{1:>06}", i+1, ind), org));
        }
    }
    ans.sort_by_key(|k| k.1);
    for a in ans {
        println!("{}", a.0);
    }
}

Measured memory_bytes: 23728
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  //入力を受け取る
  int R = 0;
  cin >> R;   //現在のレート2002
  
  int G =0;
  cin >> G;  //目標2017
  
  int z =0;  //とるべきパフォーマンス
  cout << (2 * G) - R;
  
}

Measured memory_bytes: 3564
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;

int main() {
	ll H,W;
	cin >> H >> W;
	char c;
	map<int, int>A;
	map<int, char>B;
	vector<string>S;
	string s;
	for (int i = 0; i < H; i++) {
		cin >> s;
		S.push_back(s);

	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			 c=S[i][j];
			if (c == '#') {
				
				A[(i - 1) * 52 + j - 1]++;
				A[(i - 1) * 52 + j ]++;
				A[(i - 1) * 52 + j +1]++;
				A[(i) * 52 + j +1]++;
				A[(i) * 52 + j -1]++;
				A[(i+1) * 52 + j -1]++;
				A[(i+1) * 52 + j ]++;
				A[(i+1) * 52 + j +1]++;
				B[i*52+j]='#';

			}

		}

	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (B[i * 52 + j] == '#') {

				cout<<"#";
			}
			else {
				cout<<A[i * 52 + j];

			}

		}
		cout << endl;
	}
}

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

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    for (ll i=1; i<=N; i++) {
        if(i%3 == 0 or i%5 == 0) {
            continue;
        }
        ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<bool> x(n+1);
    x[0] = true;
    rep(i,n) {
        int a; cin>>a;
        if (x[a-1]) x[a] = true;
    }

    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        if (x[i]==false) break;
        else cnt++;
    }

    int ans = n-cnt;
    cout << ((ans==n) ? (-1) : ans) << '\n';
    return 0;
}

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

int main() {
	char s = getchar();
	int tot = 0;
	while (s >= '0' && s <= '9') {
		tot += s - '0';
		s = getchar();
	}
	if (tot % 9) {
		printf("No", tot);
	}
	else {
		printf("Yes");
	}
	return 0;
}

Measured memory_bytes: 1600
from bisect import bisect_left as lower_bound
from bisect import bisect_right as upper_bound
import math
n,d,a=map(int,input().split())
X, H=[], []; ans=0; L=[]
for i in range(n):
  x,h=map(int,input().split())
  L.append((x,h))
L.sort()
for x,h in L:
  X.append(x); H.append(h)
X.append(10**9); H.append(10**9)
imos=[0]*(n+5)
de=0 # decrease count
for i in range(n):
  de+=imos[i]
  HP=H[i]-de*a
  # 右から貪欲にダメージを減らす
  # 敵の体力が残ってるとき
  # print("HP is",HP)
  if HP>0:
    atk_cnt=math.ceil(HP/a) # 何回殴る必要があるか
    de+=atk_cnt
    ans+=atk_cnt
    index=upper_bound(X,X[i]+2*d)
    # print(X,X[i]+2*d)
    # print(index, atk_cnt)
    imos[index]-=atk_cnt
print(ans)


Measured memory_bytes: 41152
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o);i++)
#define rep_s(i, o) for (int i = 1; i < (o);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b)
    {
        return b;
    }
    return a; 
}

template<class T>
bool chmin(T &a, const T &b) {
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0; 
}

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

    ll a[n]; ll sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i] - 1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

//============================================================================
#define PI 3.14159265359
#define succ(x) ((x)+1)
#define pred(x) ((x)-1)
//============================================================================
//============================================================================
void enter(FILE *file)
{
    int N,M,**aryA,*aryB,*Ans,i,m,n,v;

    fscanf(file, "%d", &N);
    fscanf(file, "%d", &M);
    aryA=malloc(M*sizeof(int*));
    for (i=0; i<M; i++)
        aryA[i]=malloc(N*sizeof(int));
    aryB=malloc(M*sizeof(int));
    Ans=malloc(N*sizeof(int));
    for (n=0; n<N; n++){
        for (m=0; m<M; m++){
            fscanf(file, "%d", &v);
            aryA[m][n]=v;
        }
    }
    for (m=0; m<M; m++)
        fscanf(file, "%d", &aryB[m]);
    for (n=0; n<N; n++)
    for (Ans[n]=m=0; m<M; m++)
        Ans[n]+=aryA[m][n]*aryB[m];
    for (n=0; n<N; n++)
        printf("%d\n", Ans[n]);

    free(Ans);
    free(aryB);
    for (i=0; i<M; i++)
        free(aryA[i]);
    free(aryA);
}
//============================================================================
#ifndef DESKTOP
int main(void)
{
    enter(stdin);
    return 0;
}
#endif

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int a, b;
    cin >> a >> b;

    int str = min(a, b);
    int loop = max(a, b);

    for(int i = 0; i < loop; i++){
        cout << str;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

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

class RangeSeg{
	int n;
	vector<ll> data, lazy;
public:
	RangeSeg(int n_){
		n = 1;
		while(n < n_) n <<= 1;
		REP(i, n*2-1){
			data.push_back(-1);
			lazy.push_back(-1);
		}
	}

	void push(int l, int r, int k){
		if(lazy[k] != -1){
			data[k] = lazy[k];
			if(r - l > 1){
				lazy[k*2+1] = lazy[k];
				lazy[k*2+2] = lazy[k];
			}
			lazy[k] = -1;
		}
	}

	void update(int s, int t, int l, int r, int k, int x){
		push(l, r, k);
		if(s <= l && r <= t){
			lazy[k] = x;
			push(l, r, k);
		}else if(l < t && s < r){
			update(s, t, (l+r)/2, r, k*2+2, x);
			update(s, t, l, (l+r)/2, k*2+1, x);
		}
	}

	void update(int s, int t, int x){
		update(s, t, 0, n, 0, x);
	}
	
	void show(){
		int i = 0;
		int en = 1;
		while(i < n*2-1){
			cout << "(" << data[i] << ", " << lazy[i] << ") ";
			if(i == en*2-2){
				cout << endl;
				en *= 2;
			}
			i++;
		}
	}

	ll find(int l, int r, int k, int i){
		push(l, r, k);
		if(r-l == 1){
			return data[k];
		}
		if(l <= i && i <= r){
			if((l+r)/2 <= i){
				return find((l+r)/2, r, k*2+2, i);
			}else{
				return find(l, (l+r)/2, k*2+1, i);
			}
		}else{
			return -1;
		}
	}

	ll find(int i){
		return find(0, n, 0, i);
	}	
};

int main(void){
	int n, q;
	cin >> n >> q;
	RangeSeg rs(n);
	REP(i, q){
		int com;
		cin >> com;
		if(com == 0){
			int s, t, x;
			cin >> s >> t >> x;
			rs.update(s, t+1, x);
		}else{
			int x;
			cin >> x;
			x = rs.find(x);
			if(x == -1)
				cout << ((ll)1 << 31)-1 << endl;
			else
				cout << x << endl;
		}
	}
}

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

typedef pair<int, int> P;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n,h,w;

bool valid(P p){
  return p.fi>=0&&p.fi<=w&&p.se>=0&&p.se<=h;
}

P ur(int x,int y){
  int d=y-x;
  P p1=P(w,w+d),p2=P(h-d,h);
  if(valid(p1))return p1;
  else return p2;
}

P ll(int x,int y){
  int d=y-x;
  P p1=P(0,0+d),p2=P(0-d,0);
  if(valid(p1))return p1;
  else return p2;
}

P ul(int x,int y){
  int d=y+x;
  P p1=P(0,d-0),p2=P(d-h,h);
  if(valid(p1))return p1;
  else return p2;
}

P lr(int x,int y){
  int d=y+x;
  P p1=P(w,d-w),p2=P(d-0,0);
  if(valid(p1))return p1;
  else return p2;
}

int calc(P p){
  assert(p.fi==0||p.fi==w||p.se==0||p.se==h);
  if(p.se==0){
    return p.fi;
  }else if(p.fi==w){
    return w+p.se;
  }else if(p.se==h){
    return w+h+(w-p.fi);
  }else if(p.fi==0){
    return w+h+w+(h-p.se);
  }
  return -1;
}

int main(){
  cin>>n>>w>>h;
  int M=w*2+h*2;
  vector<P> rs;
  rep(i,n){
    int x,y;
    cin>>x>>y;
    char c;
    cin>>c;
    if(c=='E'){
      P p1=lr(x,y); P p2=ur(x,y);
      rs.push_back(P(calc(p1),calc(p2)));
    }else if(c=='N'){
      P p1=ur(x,y); P p2=ul(x,y);
      rs.push_back(P(calc(p1),calc(p2)));
    }else if(c=='W'){
      P p1=ul(x,y); P p2=ll(x,y);
      rs.push_back(P(calc(p1),calc(p2)));
    }else{
      P p1=ll(x,y); P p2=lr(x,y);
      rs.push_back(P(calc(p1),calc(p2)));
    }
  }

  vector<P> ps;
  rep(i,rs.size()){
    if(rs[i].fi>rs[i].se)rs[i].se+=M;
    ps.push_back(P(rs[i].se,rs[i].fi));
    ps.push_back(P(rs[i].se+M,rs[i].fi+M));
  }
  sort(all(ps));

  int res=0;
  rep(i,n){
    int tmp=0,last=0;
    for(int j=i;ps[j].fi<ps[i].se+M;j++){
      if(last<ps[j].se){
        tmp++;
        last=ps[j].fi;
      }
    }
    maxch(res,tmp);
  }

  cout<<res<<endl;
  return 0;
}



Measured memory_bytes: 3136
import sys
import itertools
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数
from math import ceil, floor, sqrt, isinf #小数点切り上げ、切り捨て、平方根
from copy import deepcopy #参照で影響されないコピー
from collections import Counter, deque #要素ごとの出現回数、双方向アクセス可能データ型
import heapq
import numpy as np
from functools import reduce
sys.setrecursionlimit(200000)

input = sys.stdin.readline
# template


n = int(input())
#h = list(map(int, input().split()))
h = [int(x) for x in input().split()]

dp = [1e9] * n

dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if(i > 1):
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[n-1])


Measured memory_bytes: 23996
import java.util.*;

public class Main {
  public static void main(final String[] args) {
    final Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.close();

    if (N <= M) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    vector<char> s(n); rep(i, n) cin >> s[i];
    set<char> st;
    rep(i, n) {
        st.insert(s[i]);
    }

    if (st.size() == 3) {
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }



    return 0;
}

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

int main() {
    int n,x;
	int count = 0;
	int d = 0;
	int l[100];
	
    cin >> n >> x;
	
	for(int i = 0;i < n;i++){
  	  cin >> l[i];
	}
	
	while(d <= x){
		d += l[count];
		count++;
	}
	
	cout << count;
	
	return 0;
}

Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var h = int.Parse(Console.ReadLine());
			var w = int.Parse(Console.ReadLine());
			var n = int.Parse(Console.ReadLine());

			int a = 0;	// 作業回数 a
			int x = 0;  // 列を塗る回数 x

			int max = Math.Max(h, w);
			int count = n % max == 0 ? n / max : n / max + 1;

			Console.WriteLine(count);
		}
	}
}


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

using namespace std;

int main()
{
    char s1[20000];
    while (true)
    {
        scanf("%s", s1);
        if (strcmp(s1, "-") == 0)
            break;
        int len1 = strlen(s1);
        int count = 0;
        int n, m;
        cin >> n;
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &m);

            for (int j = 0; j < m; j++)
            {
                s1[len1 + j + count] = s1[j + count];
            }
            count += m;
        }
        for (int i = 0; i < len1; i++)
        {
            cout << s1[i+count];
        }

        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-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;
}
const ll INF = 10010001010;
const int inf = 1000034000;
 
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int main() {
  int a1;
  cin >>a1;
  cout <<a1 +a1*a1+a1*a1*a1<<endl;
} 

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  if(A==B)  cout << "Draw" << endl;
  else if(A==1) cout << "Alice" << endl;
  else if(B==1) cout << "Bob" << endl;
  else if(A>B)  cout << "Alice" << endl;
  else  cout << "Bob" << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

def main():
    N = int(input())
    A = list(map(int, input().split()))
    d = defaultdict(int)
    for a in A:
        d[a] += 1

    key = list(d.keys())
    key.sort(reverse=True)
    cnt = 0
    ans = 0
    tmp = 0
    flag = False
    for i in key:
        if d[i] >= 4:
            ans = i * i
            flag = True
            break
    for i in key:
        if d[i] >= 2:
            if cnt == 0:
                tmp = i
            elif cnt == 1:
                tmp *= i
                ans = max(ans, tmp)
                print(ans)
                exit()
            cnt += 1

    if not flag:
        print(0)
    else:
        print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 105788
#include <stdio.h>
#include <iostream>

#include <bits/stdc++.h>


using namespace std;

#define INPUT_INT(valName) int valName; cin >> valName;
#define INPUT_STR(valName) string valName; cin >> valName;
#define INPUT_LINE(valName) string valName; getline(cin,s);
#define INPUT_VECTOR_INT(valName, N) vector<int> valName(N); for(int i=0; i < N; ++i) { cin >> valName[i]; }

#define OUTPUT(A) cout << (A) << endl;
#define OUTPUT2(A, B) cout << (A) << " " << (B) << endl;
#define OUTPUT3(A, B, C) cout << (A) << " " << (B) << " " << (C) << endl;

#define REP(valName, N) for(int valName = 0; valName < N; ++valName)

vector<string> split(const string &str, char delimiter) {
	vector<string> ret;
	string tmp = "";
	for (auto c : str) {
		if (c != delimiter) {
			tmp.push_back(c);
		} else {
			ret.push_back(tmp);
			tmp = "";
		}
	}
	ret.push_back(tmp);
	return ret;
}

template <typename T> void sortAsc(vector<T>& v) { sort(v.begin(), v.end(), less<T>()); }
template <typename T> void sortDesc(vector<T>& v) { sort(v.begin(), v.end(), greater<T>()); }


int main() {

	INPUT_INT(N);
	INPUT_VECTOR_INT(A, N);

	double x = 0.0;
	REP(i, N) {
		x += 1.0/A[i];
	}

	OUTPUT(1.0 / x);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0; i<n; ++i)

int main(){
    int N ,M;
    std::cin >> N >> M;

    int A[M];
    for(int i=0; i<M; ++i) std::cin >> A[i];

    int t = N;
    for(int i; i<M; ++i){
         t = t - A[i];
    }

    if(t<0){
        t = -1;
    }

    std::cout << t << std::endl;

}

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

const int INF = 1001001001;

void Main() {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> key;
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    int s = 0;
    rep(j, b) {
      int c;
      cin >> c;
      c--;
      s += 1 << c;
    }
    key.emplace_back(s, a);
  }

  vector<int> dp(1 << N, INF);
  dp[0] = 0;
  rep(s, 1<<N) {
    rep(i, M) {
      int t = s | key[i].first;
      int cost = dp[s] + key[i].second;
      dp[t] = min(dp[t], cost);
    }
  }
  int ans = dp.back();
  if (ans == INF) {cout << -1 << endl; return;}
  cout << ans;
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int x,y,i,j,k;
  long long int ans=0;
  scanf("%d %d",&x,&y);
  for(i=0;i<=x;i++){
    for(j=0;j<=x;j++){
      if(0<=y-(i+j) && y-(i+j)<=x) ans++;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 128
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [-1]*n
s = []
v = 0

while b[v] == -1:
    b[v] = len(s)
    s.append(v)
    v = a[v]-1
    
c = len(s) - b[v]
l = b[v]

if k < l:
    print(s[k]+1)
else:
    k -= l
    k %= c
    print(s[l+k]+1)

Measured memory_bytes: 32376
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//

ll mod_pow(ll x, ll n){
  ll res = 1;
  while(n > 0){
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll a = mod_pow(10, n);
  ll b = mod_pow(9, n);
  ll c = mod_pow(8, n);
  ll ans = a; 
  ans -= (2*b)%mod;
  ans += c;
  ans %= mod;
  if (ans < 0 ) ans += mod;
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007, INF = 1111111111;
const double EPS = 1e-9;


int main() {

	cin.tie(0);

	int A, B, C;
	cin >> A >> B >> C;

	int mod0 = A % B, sum = A;

	do {

		sum += A;
		
		if (sum%B == C) {

			cout << "YES";
			return 0;
		}
	}
	while (mod0 != sum%B);

	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m;
	cin>>n>>m;
	string a = to_string(n);
	string ans="",ans1="";
	for(ll i=0;i<m;i++)
		ans+=a;
	string b = to_string(m);
	for(ll i=0;i<n;i++)
		ans1+=b;
	if (ans<ans1)
		cout<<ans;
	else
		cout<<ans1;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[10],k;
	for(int i=0;i<5;i++ ) 
		cin >> a[i] ;
	cin >>k;
	sort(a,a+5) ;
	if(a[4]-a[0]<=k)  cout <<"Yay!";
	else cout <<":(";
	return 0;
}

Measured memory_bytes: 256
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int n;
LL A[100005], B[100005];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld %lld", &A[i], &B[i]);
	}

	LL ans = 0;
	LL total = 0;
	for (int i = n; i >= 1; i--) {
		A[i] += total;
		if (A[i] % B[i] == 0) {
			continue;
		}
		else {
			LL rem = A[i] % B[i];
			rem = B[i] - rem;
			total += rem;
			ans += rem;
		}
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 1920
N = int(input())
# 題意は「1~Nの値iにおいて、Nまでにあるiの倍数の総和を求めよ」ということなので
sum = 0
for i in range(1, N+1):
    k = N // i # k = iの倍数の項数
    sum += int(i * k * (k+1) / 2)
print(sum)


Measured memory_bytes: 81292
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <map>
#include <cstring>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
const long long MAX=200005;
typedef long long ll;
const int INF=0x3f3f3f3f;
//int d[8][2]={-1,0,0,-1,0,1,1,0,1,1,-1,-1,-1,1,1,-1};
int main()
{
    int a[4][4];
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)
        scanf("%d",&a[i][j]);
    int k=a[1][1]+a[2][2]+a[3][3];
    if(a[1][2]+a[2][3]+a[3][1]!=k||a[1][3]+a[2][1]+a[3][2]!=k)
    {
        printf("No\n");
        return 0;
    }
    if(a[1][1]+a[2][3]+a[3][2]!=k||a[1][2]+a[2][1]+a[3][3]!=k||a[1][3]+a[2][2]+a[3][1]!=k)
    {
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}


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

using namespace std;

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

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-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;}

const int MAX_D=365;
const int MAX_type=26;
const int BeamWidth=200;

int D;
int c[MAX_D+5];
int s[MAX_D+5][MAX_type+5];

struct State{
    vector<int> contest;
    vector<int> last;
    int day;
    int score;

    State(){
        //cout<<"hoge"<<endl;
        day=1;
        score=0;
        for(int i=0;i<MAX_type+5;++i)last.push_back(0);
        //fill(last.begin(),last.end(),0);
        //cout<<last[0]<<endl;
    }

    void update(int type){
        contest.push_back(type);
        last[type]=day;
        score+=s[day][type];
        for(int i=1;i<=MAX_type;++i){
            score-=c[i]*(day-last[i]);
        }
        day++;
    }

    State nextState(State now,int type){
        State next;
        next=now;
        next.update(type);
        return next;
    }
};

bool operator< (const State &state1, const State &state2){
    return state1.score < state2.score;
};

bool operator> (const State &state1, const State &state2){
    return state1.score > state2.score;
};

State beamsearch(){
    int D_=D;
    priority_queue<State, vector<State>, greater<State> > nowpq;
    //priority_queue<State> nowpq;
    for(int type=1;type<=MAX_type;++type){
        State s;
        //cout<<s.score<<endl;
        //cout<<s.nextState(s,type).contest[0]<<endl;
        nowpq.push(s.nextState(s,type));
    }
    while(nowpq.size()>BeamWidth)nowpq.pop();
    D_--;
    while(D_--){
        //cout<<D<<endl;
        priority_queue<State, vector<State>, greater<State> > nextpq;
        //priority_queue<State> nextpq;
        while(nowpq.size()){
            State now=nowpq.top();
            nowpq.pop();
            for(int type=1;type<=MAX_type;++type){
                nextpq.push(now.nextState(now,type));
            }
        }
        while(nextpq.size()>BeamWidth)nextpq.pop();
        nowpq=nextpq;
    }
    while(nowpq.size()>1)nowpq.pop();
    State ret=nowpq.top();
    return ret;
}

void input(){
    cin>>D;
    for(int i=1;i<=MAX_type;++i)cin>>c[i];
    for(int i=1;i<=D;++i){
        //cout<<D<<endl;
        for(int j=1;j<=MAX_type;++j){
            cin>>s[i][j];
        }
    }
}

signed main(){
    input();
    auto res=beamsearch();
    if(res.contest.size()!=D)cout<<0/0<<endl;
    for(auto u:res.contest){
        cout<<u<<endl;
    }
    //cout<<"score is "<<res.score<<endl;
    //for(int i=0;i<MAX_type;++i)cout<<res.last[i]<<endl;
    //int score=0;
}

Measured memory_bytes: 35612