akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int N,M;
	vec(T)
	cin>>N;
	ll ans=0;
	fx(N){
		vecp(T)
		ans+=aa;
	}
	cin>>M;
	fy(M){
		int p,x;
		cin>>p>>x;
		ll ans2=ans;
		ans2-=T.at(p-1);
		ans2+=x;
		ce(ans2)
	}
	
	
}

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

ans = 0
L = []
ans_L = {}

for i in range(N):
    L.append(int(input()))

for j in L:
    if not j in ans_L.keys():
        ans_L[j] = 0
    
    if ans_L[j]==0:
        ans_L[j] += 1
    elif ans_L[j]== 1:
        ans_L[j] -= 1

print(sum(ans_L.values()))

Measured memory_bytes: 16268
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        int K = Integer.parseInt (reader.readLine());
        String S = reader.readLine();
        if (S.length() <= K)
            System.out.println (S);
        else
            System.out.println (S.substring (0, K) + "...");
        return;
    }
}

Measured memory_bytes: 36208
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i = 0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAX = 185;

int main()
{
    int p, q;
    while(cin >> p >> q )
    {
        int quot[MAX] = {}, resi[MAX] = {};
        int b = -1, e = -1, iscycle = 1;
        for(int i = 0; p != 0;i++)
        {
            quot[i] = p / q;
            resi[i] = p % q;
            p = (p % q) * 10;
            rep(j,i)if(resi[i] == resi[j]){ b = j; e = i ; break; }
            if(b != -1) break;

            if(resi[i] == 0){ e = i; iscycle = 0; break;}
        }
        if(iscycle)
        {
            REP(e) cout << quot[i + 1] ; cout << endl;
            REP(e)
            {
                if(i < b) cout << " ";
                else cout << "^";
            }
            cout << endl;
        }
        else { REP(e) cout << quot[i + 1]; cout << endl;}
    }

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define all(vec) vec.begin(), vec.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl
#define isEven(t) t % 2 == 0

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


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

	int N, D, X;
	int ans=0;
	cin>>N>>D>>X;

	for (int i = 0; i < N; i++) {
		int A;
		cin>>A;
		ans += (D - 1) / A;
	}

	cout << ans + X + N << endl;

	return 0;
}

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

int main() {

vector<int>cost(3);
for(int i = 0; i < 3; i++){
  cin >> cost.at(i);
}
sort(cost.begin(), cost.end());

int sum = 0;
for(int i = 0; i < 2; i++){
  sum += cost.at(i + 1) - cost.at(i);
}
cout << sum << endl;
}
 

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

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int a;
    cin >> a;
    ld res = 2*acos(-1)*a;
    printf("%llf\n", res);
    return 0;
}

Measured memory_bytes: 3784
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 100000000
#define INF 1000000000000000000
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    map<string,ll>m;
    ll q;cin>>q;
    while(q--){
        ll a;cin>>a;
        if(a==0){
            string key;cin>>key;
            ll x;cin>>x;
            m[key]=x;
            //cout<<m[key]<<endl;
        }
        else if(a==1){
            string key;cin>>key;
            cout<<m[key]<<endl;
        }
        else if(a==2){
            string key;cin>>key;
            m[key]=0;
        }
        else{
            string l,r;cin>>l>>r;
            auto left=m.lower_bound(l);
            auto right=m.upper_bound(r);
            for(auto it=left;it!=right;it++){
                if(it->se)
                cout<<it->fi<<" "<<it->se<<endl;
            }
        }
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





































Measured memory_bytes: 25932
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (usize, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };
    let a: Vec<i64> = (0..N)
        .map(|_| {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse().unwrap()
        })
        .collect();

    struct SegmentTree<T: Clone + Copy, F: Fn(T, T) -> T> {
        n: usize,
        f: F,
        e: T,
        x: Vec<T>,
    }

    impl<T: Clone + Copy, F: Fn(T, T) -> T> SegmentTree<T, F> {
        fn new(n: usize, f: F, e: T) -> SegmentTree<T, F> {
            let m = 1 << format!("{:b}", n).len();
            SegmentTree {
                n: m,
                f: f,
                e: e,
                x: vec![e; 2 * m - 1],
            }
        }
        fn update(&mut self, i: usize, y: T) {
            let mut j = i + self.n - 1;
            self.x[j] = y;
            while j > 0 {
                j = (j - 1) / 2;
                self.x[j] = (self.f)(self.x[2 * j + 1], self.x[2 * j + 2]);
            }
        }
        fn find(&self, s: usize, t: usize) -> T {
            self.q(0, 0, self.n, s, t)
        }
        fn q(&self, i: usize, l: usize, r: usize, s: usize, t: usize) -> T {
            if l >= t || r <= s {
                self.e
            } else if s <= l && r <= t {
                self.x[i]
            } else {
                (self.f)(
                    self.q(2 * i + 1, l, (l + r) / 2, s, t),
                    self.q(2 * i + 2, (l + r) / 2, r, s, t),
                )
            }
        }
    }

    let acc = a
        .iter()
        .scan(0, |state, &x| {
            *state += x - K;
            Some(*state)
        })
        .collect::<Vec<_>>();
    let sorted_acc = {
        let mut sorted_acc = acc.clone();
        sorted_acc.push(0);
        sorted_acc.sort();
        sorted_acc
    };
    let mut p = std::collections::HashMap::new();
    let mut r = 0;
    p.insert(sorted_acc[0], 0);
    for i in 0..N {
        if sorted_acc[i + 1] > sorted_acc[i] {
            r += 1;
        }
        p.insert(sorted_acc[i + 1], r);
    }
    let mut c = SegmentTree::new(N, |x, y| x + y, 0);
    let mut res: usize = 0;
    c.update(p[&0], 1);
    for i in 0..N {
        res += c.find(0, p[&acc[i]] + 1);
        let x = c.find(p[&acc[i]], p[&acc[i]] + 1) + 1;
        c.update(p[&acc[i]], x);
    }

    let ans = res;
    println!("{}", ans);
}


Measured memory_bytes: 19256
n, k = map(int, input().split())
a = list(map(int, input().split()))
li = []
for l in range(n):
    s = 0
    i = l
    while i < n:
        s += a[i]
        li.append(s)
        i += 1
# print(li)
ans = 0
for i in range(40):
    j = 39 - i
    if sum(map(lambda x: (x >> j) & 1, li)) >= k:
        ans += 1 << j
        tmp = []
        for x in li:
            if (x >> j) & 1:
                tmp.append(x)
        li = tmp
print(ans)


Measured memory_bytes: 65788
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;
 
int main() {
  bool order = true;
  
  string S;
  int Q;
  cin >> S >> Q;
  
  int T = 0;
  int F = 0;
  char C;
  deque<char> L;
  deque<char> R;
  
  for(int i=0; i<Q; i++) {
    cin >> T;
    // Ti = 1の時
    if(T==1) {
      order = !order;
      continue;
    }
    // Ti = 2の時
    cin >> F >> C;
    if((F==1 && order==true) || (F==2 && order==false)) {
      L.push_front(C);
    } else {
      R.push_back(C);
    }
  }
  
  if(order) {
    for(auto itr = L.begin(); itr != L.end(); ++itr) {
        cout << *itr;
    }
    for(auto itr = S.begin(); itr != S.end(); ++itr) {
        cout << *itr;
    }
    for(auto itr = R.begin(); itr != R.end(); ++itr) {
        cout << *itr;
    }
  } else {
    for(auto itr = R.rbegin(); itr != R.rend(); ++itr) {
        cout << *itr;
    }
    for(auto itr = S.rbegin(); itr != S.rend(); ++itr) {
        cout << *itr;
    }
    for(auto itr = L.rbegin(); itr != L.rend(); ++itr) {
        cout << *itr;
    }
  }
  
  return 0;
}

Measured memory_bytes: 896
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M = MAP()
    if M == 0:
        if N == 1:
            print(0)
        elif N == 2:
            print(10)
        else:
            print(100)
        exit()
        
    m = N
    l = [10] * N
    for i in range(M):
        s, c = MAP()
        if l[s-1] == 10:
            l[s-1] = c
            m = s - 1 if s-1 < m else m
        else:
            if c != l[s-1]:
                print(-1)
                sys.exit()
                
    if N == 1 and l[0] == 0:
        print(0)
        sys.exit()
        
    ans = ""
    if not len(l) == N-m and l[m] == 0: ans += "1"
    for i in range(N-m):
        ans += str(l[i+m] % 10)
        
    flag = False
    for i in range(N-m):
        if not int(ans[i]) == 0:
            flag = True
        if not flag and int(ans[i]) == 0:
            print(-1)
            sys.exit()
            
    print('1' + '0'*(m-1) + ans if len(ans) < N else ans)
    
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 60012
//g++-7 filename.cpp -std=c++14
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define pq priority_queue<int, vector<int>, greater<int>> //min pq
#define endl '\n'
#define out(x) cout << x << endl
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl;
typedef pair<int, int> pi; typedef vector<pi> vpi;
typedef pair<ll,ll> pl; typedef vector<array<int,3>> multiv;

const ll TIME = chrono::high_resolution_clock::now().time_since_epoch().count();
const ll SEED = (ll)(new ll);
const ll RANDOM = TIME ^ SEED;
const ll MUL = (int)1e6+3;
 
struct chash{
    ll operator()(ll x) const { return std::hash<ll>{}((x ^ RANDOM) % MOD * MUL); }
};
 
gp_hash_table<ll, int, chash> H;

int n, k;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	//freopen("input.in","r",stdin); //freopen("input.out","w",stdout);	
	//before you start coding, think it through
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		H[i % k]++;
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		int look = (k - (i % k)) % k;
		if(H.find(look) != H.end() && (look + look) % k == 0){
			ans += (ll) H[look] * (ll) H[look];
			// cout << i << " " << look << " " << H[look] << endl;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
struct p {
    ld x, y;
    p(ld x = 0, ld y = 0) : x(x), y(y) {}
};
int main() {
    init();
    ll N;
    cin >> N;
    vc<p> A(N);
    rep(i, N) cin >> A[i].x >> A[i].y;

    vvc<ld> dist(N, vc<ld>(N));
    rep(i, N) repe(j, i + 1, N) {
        dist[i][j] = dist[j][i] = hypot(A[i].x - A[j].x, A[i].y - A[j].y);
    }

    // 中心p1, p2で半径rの2円の交点を返す
    auto cross = [&](ll i1, ll i2, ld r) -> pair<p, p> {
        auto p1 = A[i1], p2 = A[i2];
        ld l = dist[i1][i2] / 2;

        p m = {(p1.x + p2.x) / 2, (p1.y + p2.y) / 2};
        p h = {(p1.y - p2.y) / 2, (p2.x - p1.x) / 2};
        ld a = sqrt(r * r - l * l);
        h.x *= a, h.x /= l, h.y *= a, h.y /= l;

        p r1 = {m.x + h.x, m.y + h.y}, r2 = {m.x - h.x, m.y - h.y};
        return {r1, r2};
    };

    ld ng = 0, ok = 0;
    rep(i, N) chmax(ok, hypot(A[i].x, A[i].y));

    queue<p> q;
    rep(_, 100) {
        ld r = (ok + ng) / 2;
        rep(i, N) repe(j, i + 1, N) {
            if (dist[i][j] > 2 * r + EPS) continue;
            auto ret = cross(i, j, r);
            q.emplace(ret.first), q.emplace(ret.second);
        }

        bool isok = false;
        while (!q.empty()) {
            auto pt = q.front();
            q.pop();
            bool passed = true;
            rep(i, N) {
                if (hypot(A[i].x - pt.x, A[i].y - pt.y) > r + EPS) {
                    passed = false;
                    break;
                }
            }

            if (passed) {
                isok = true;
                break;
            }
        }

        (isok ? ok : ng) = r;
    }
    cout << ok << endl;
}

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

int a[10];

bool dfs(int n,int l,int r)
{
	if(n>=10)return true;
	if(l<a[n])if(dfs(n+1,a[n],r))return true;
	if(r<a[n])if(dfs(n+1,l,a[n]))return true;
	return false;
}

int main()
{
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<10;j++)cin>>a[j];
		if(dfs(0,-1,-1))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max(x,max(y,z))
#define MX4(x,y,z,p) max(x,max(y,max(z,p)))
#define MX5(x,y,z,p,q) max(x,max(y,max(z,max(p,q))))
#define MN3(x,y,z) min(x,min(y,z))
#define MN4(x,y,z,p) min(x,min(y,min(z,p)))
#define MN5(x,y,z,p,q) min(x,min(y,min(z,min(p,q))))
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################
const long long MOD = 998244353;
 

const double __gauss_template_EPS = 1e-8;

int Gauss(vector<vector<int>> &mat) {
    // return rank
    int rank = 0;
    int n = (int)mat.size();

    for(int i = 0; i < n; i++) {
        bool ok = false;
        for(int j = rank; j < n; j++) {
            if(mat[j][i]) {
                swap(mat[j], mat[rank]);
                ok = true;
                break;
            }
        }

        if(!ok) continue;

        int fs = mat[rank][i];

        for(int j = rank+1; j < n; j++) {
            int r = mat[j][i] / fs;

            for(int k = i; k < n; k++) {

                mat[j][k] ^= mat[rank][k] * r;
            }
        }

        rank++;
    }

    return rank;
}

 
 
const long long __exp_template_MOD = MOD;
const long long mod = MOD;
int qpow(int x, int n){ int y = 1; while(n){ if(n & 1) y = (ll) y * x % mod; x = (ll) x * x % mod; n >>= 1; } return y; }
 
long long exp(int a, int b) {
    if(b == 0) return 1;
    long long tmp = exp(a, b/2);
    if(b & 1) {
        return (long long)tmp*tmp%__exp_template_MOD*a%__exp_template_MOD;
    }
    return (long long)tmp*tmp%__exp_template_MOD;
}
 
void solve() {
    int n, m;
    SI(n);
    SI(m);
    vvi rec(max(n, m),vi(max(n,m), 0));
    REP(i, n) {
        REP(j, m) {
            scanf("%d", &rec[i][j]);
        }
    }
    int r = Gauss(rec);
 
    printf("%lld\n", ((qpow(2, n+m-1) - qpow(2, n+m-r-1))%MOD+MOD)%MOD);
}
 
void init() {
    
 
 
}
 
int main () {
    init();
    solve();
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        String S = sc.next();

        System.out.println(solve(S));
    }

    private static String solve(String S) {
        for (int i=0; i<S.length(); i++) {
            char c = S.charAt(i);
            if (i%2 == 1) {
                if (c == 'R') {
                    return NO;
                }
            } else {
                if (c == 'L') {
                    return NO;
                }
            }
        }

        return YES;
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main(){
    int N,M;
    cin >> N >> M;
    map<int,int>Mp;
    for(int i = 0; i < N; i++) {
        int K;cin >> K;
        for(int j = 0; j < K; j++) {
            int A;cin >> A;
            Mp[A]++;
        }
    }
    int ans = 0;
    for(P x:Mp) {
        if(x.second == N) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3532
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

int main(){
	int N; std::cin >> N;
	std::vector<std::string> W(N);
	for (auto& r : W) std::cin >> r;
	char check;
	for (int i = 0; i < N; ++i) {
		if (i > 0 && check != W[i][0]) {
			std::cout << "No" << std::endl;
			return 0;
		}
		check = W[i].back();
		if (i > 0) {
			for (int j = i - 1; 0 <= j; --j)
				if (W[i] == W[j]) {
					std::cout << "No" << std::endl;
					return 0;
				}
		}
	}
	std::cout << "Yes" << std::endl;

	return 0;
}

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

int main(void){
    string s;
    cin >> s;
    
    int len = s.length();
    bool flag = false, c_f = false;
    string ans = "AC";
    if(s.at(0) != 'A' || s.at(1) == 'C' || s.at(len-1) == 'C') ans = "WA";
    rep(i, len-1){
        rep(j, 26){
            if(s.at(i+1) == 'a'+j){
                flag = true;
            }
            if(s.at(i+1) == 'C'){
                if(c_f) ans = "WA";
                c_f = true;
                flag = true;
                break;
            }
        }
        if(!flag) ans = "WA";
        flag = false;
    }
    if(!c_f) ans = "WA";

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

Measured memory_bytes: 256
def contains?(input, char)
  a = true
  input.each do |str|
    i = str.index(char)
    a &&= i
  end

  a
end

input = []
gets
while l = gets do
  input << l.chomp
end
ans = ""

('a'..'z').each do |char|
  while contains?(input, char)
    input.each do |str|
      str.slice!(str.index(char))
    end

    ans = "#{ans}#{char}"
  end
end

puts ans


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

int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0) ;

	int a, b, c, d, e ;
	cin >> a >> b >> c >> d >> e ;
	int m = 0 ;
	int t = a ;
	a = (a+9)/10*10 ;
	m = max(m, a-t) ;
    t = b ;
	b = (b+9)/10*10 ;
	m = max(m, b-t) ;
	t = c ;
	c = (c+9)/10*10 ;
	m = max(m, c-t) ;
	t = d ;
	d = (d+9)/10*10 ;
	m = max(m, d-t) ;
	t = e ;
	e = (e+9)/10*10 ;
	m = max(m, e-t) ;
	cout << a+b+c+d+e-m ;

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
const int N = 1e5+5;
int dp[N];

signed main(){
	IOS
	int n;	cin >> n;
	int a[n];
	rep(i,n)	cin >> a[i];
	rep(i,n){
		if(i == 0)	dp[i] = 0;
		else if(i == 1)	dp[i] = abs(a[i] - a[i-1]);
		else 		dp[i] = min(abs(a[i] - a[i-2]) + dp[i-2],abs(a[i] - a[i-1]) + dp[i-1]);
	}
	cout << dp[n-1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define repl(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    int n;
    cin >> n;
    vector<int> a(n,0);
    int cnt_e = 0;
    rep(i,n){
        cin >> a[i];
        if(a[i]%2 == 0)cnt_e++;
    }
    cout << pow(3,n) - pow(2,cnt_e) << endl;
    return 0;
}

Measured memory_bytes: 384
n,k = map(int,input().split())
vis = [0 for _ in range(n)]
for _ in range(k):
  d = int(input())
  v = list(map(int,input().split()))
  for i in v:
    vis[i-1] += 1
ans = 0
for i in vis:
  if i == 0:
    ans += 1
print(ans)

Measured memory_bytes: 9112
N = int(input())
A = [a for a in map(int, input().split())]

#N個のボールに対して、書かれている数字は1~Nまで

dic1 = {}
for i in range(N):
    dic1[i+1] = 0

#dicにkeyとなる数字の個数を入れていく
for i in range(N):
    if A[i] in dic1.keys():
        dic1[A[i]] += 1

dic2 = {}
#組み合わせの数を入れる   
for i in range(N):
    dic2[i+1] = dic1[i+1]*(dic1[i+1]-1)/2

ans1 = 0
for i in range(N):
    ans1 += dic2[i+1]

for i in range(N):
    ans2 = ans1
    ans2 -= dic2[A[i]] #組み合わせの数を引く
    ans2 += (dic1[A[i]]-1)*(dic1[A[i]]-2)/2 #新たな組み合わせの数を足す
    print(int(ans2))

Measured memory_bytes: 68216
import sys
from functools import reduce
from math import gcd

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    pairwise = True
    used = [False] * (max(A) + 1)
    
    # 同じ素因数を含むA[i]が存在するか判定
    for a in A:
        for i in range(2, int(a ** 0.5) + 1):
            if a % i == 0:
                if used[i]:
                    pairwise = False
                else:
                    used[i] = True
                    while a % i == 0:
                        a //= i
        if a != 1:
            if used[a]:
                pairwise = False
                break
            else:
                used[a] = True

    # setwiseか判定
    g = reduce(gcd, A)

    if pairwise:
        print('pairwise coprime')
    else:
        if g == 1:
            print('setwise coprime')
        else:
            print('not coprime')


if __name__ == '__main__':
    main()


Measured memory_bytes: 184112
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#include <queue>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
{
    return x>y;
}
const int N=10005;
const int mod=1e9+7;
int main()
{
    std::ios::sync_with_stdio(false);
    int n,l;
    cin>>n>>l;
    string a;
    priority_queue<string,vector<string>,greater<string> >q;
    for(int i=0;i<n;i++){
        cin>>a;
        q.push(a);
    }
    while(q.size()>0){
        string b=q.top();
        cout<<b;
        q.pop();
    }
    cout<<endl;
    return 0;
}

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

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DLOG(...)
#endif

void debug(auto f) {
#if DEBUG
  f();
#endif
}

ll N;
vector<ll> A;
vector<ll> ord;

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif


  cin >> N;
  A.resize(N);
  for (ll i = 0; i < N; i++) {
    ll x;
    cin >> x;
    A.at(i) = x - i;
  }
  ord.resize(N);
  for (ll i = 0; i < N; i++)  ord.at(i) = i;
  sort(ord.begin(), ord.end(), [](ll x,ll y){ return A.at(x) < A.at(y); });
  ll b = A.at(ord.at(N / 2));
  ll sad = 0;
  for (ll i = 0; i < N; i++)  sad += abs(A.at(i) - b);
  cout << sad << endl;
  return 0;
}



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

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

	string S, T;
	int a = 0;
	cin >> S >> T;
	for (int i = 0; i < S.size(); i++) 
		if (S[i] != T[i]) a++;
	cout << a;
	
	return 0;
}

Measured memory_bytes: 3748
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  N = readint()[1]
  A = readint()
  Q = readint()[1]

  v = Vector{int}(undef,10^5)
  v.=0
  s = 0
  for i in 1:N
    s += A[i]
    v[A[i]] += 1
  end

  for i in 1:Q
    B,C = readint()

    s += (C-B)*v[B]
    v[C] += v[B]
    v[B] = 0
    println(s)
    
  end
  
end

main()

Measured memory_bytes: 203860
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Irreversible operation
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef long long ll;

/* global variables */

char s[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  scanf("%s", s);

  ll sum = 0;
  int bn = 0;
  for (int i = 0; s[i]; i++) {
    if (s[i] == 'B') bn++;
    else sum += bn;
  }

  printf("%lld\n", sum);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << (a != c) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  int t[N+1], x[N+1], y[N+1]; 
  t[0] = 0; x[0] = 0; y[0] = 0;
  rep(i, N) cin >> t[i+1] >> x[i+1] >> y[i+1];

  string result = "Yes";
  rep(i, N) {
    int dis = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
    int time = t[i+1] - t[i];
    if (time>=dis && (time-dis)%2==0) continue;
    else {result = "No"; break;}
  }
  cout << result << endl;
  return 0;
}

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

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define Scan(a) scanf ("%I64d", &a)
#define scan(a) scanf ("%d", &a)
#define int long long

using namespace std;

const int inf = (int)1e9 + 7;
const int N = (int)2e6 + 7;

int n;
int a[N];
int l = inf,r;
int b[N];
int t[N];
int nn;

int get (int pos) {
      int res = 0;
      for (; pos > 0; pos -= (pos & -pos))
            res += t[pos];
      return res;
}
void upd (int pos,int val) {
      for (; pos < N; pos += (pos & -pos))
            t[pos] += val;
}

int f (int x) {
      int ans = 0;
      for (int i = 1; i <= n; i ++) {
            if (a[i] >= x) b[i] = 1;
            else b[i] = -1;
            b[i] += b[i - 1];
      }
      int mn = inf;
      for (int i = 1; i <= n; i ++) {
            mn = min(mn,b[i]);
      }
      mn = min(mn,0ll);
      mn = abs(mn);

      b[0] = 0;

      for (int i = 0; i <= n; i ++)
            b[i] += mn + 1;

      upd(b[0],1);
      for (int i = 1; i <= n; i ++) {
            ans += get(b[i]);
            upd(b[i],1);
      }
      upd(b[0],-1);
      for (int i = 1; i <= n; i ++)
            upd(b[i],-1);
      return ans;
}
main () {
      scanf ("%lld", &n);

      nn = (n * (n + 1)) / 2;

      for (int i = 1; i <= n; i ++) {
            scanf ("%lld", &a[i]);
            r = max(r,a[i]);
            l = min(l,a[i]);
      }
      while (r - l > 1) {
            int m = (r + l) >> 1;
            if (f(m) >= (nn + 1) / 2) l = m;
            else r = m;
      }
      if (f(r) >= (nn + 1) / 2) l = r;

      cout << l << endl;
}


Measured memory_bytes: 13312
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n: usize = read();
    let xy = { (0..n).map(|_| read_cols!(i64, i64)).collect::<Vec<_>>() };

    let ans = max(
        {
            let mi = xy.iter().map(|(x, y)| x - y).min().unwrap();
            let ma = xy.iter().map(|(x, y)| x - y).max().unwrap();

            (mi - ma).abs()
        },
        {
            let mi = xy.iter().map(|(x, y)| x + y).min().unwrap();
            let ma = xy.iter().map(|(x, y)| x + y).max().unwrap();

            (mi - ma).abs()
        },
    );

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


Measured memory_bytes: 5124
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		for(int i = 0 ; i < n ;i++){
			String line = br.readLine();
			char[] c = line.toCharArray();
			Arrays.sort(c);
			String min="",max="";
			for(int j = 0 ; j<c.length;j++){
				min += c[j];
				max += c[c.length-j-1];
			}
			int a = Integer.parseInt(min);
			int b = Integer.parseInt(max);
			System.out.println(b-a);
		}
	}

}

Measured memory_bytes: 24056
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    scanf("%d", &N);
    int X[2000000];
    int X_in[200000];

    for(int i=0; i < N; i++){
        scanf("%d", &X[i]); 
        X_in[i] = X[i];
      
    }
    sort(X, X+N);
    int med_l = X[N/2 - 1];
    int med_r = X[N/2 ];
    
    if(med_l==med_r){
        for(int i =0; i < N; i++) cout << med_l << endl; 
        return 0;
    }

    for(int i =0; i < N; i++){
        if(X_in[i] <= med_l) cout << med_r << endl;
        else cout << med_l << endl;
    } 
    return 0;

}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char a[100];
    int k;
    cin>>k;
    cin>>a;
    if(k>=strlen(a)){
    	for(int i=0;i<strlen(a);i++){
    		cout<<a[i];
		}
	}
	else{
		for(int j=0;j<k;j++){
			cout<<a[j];
		}
		cout<<"...";
	}
	return 0;
}

Measured memory_bytes: 3648
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}

int vis[M+5];

 main()

{
    fast
    int n,c,k;
    cin>>n>>c>>k;
    priority_queue<pair<int,pi>>yo,Magic;
    f(i,1,n)
    {
        int lft;
        cin>>lft;
        int rgt=lft+k;
        yo.push(mp(-rgt,mp(-lft,-i)));
        Magic.push(mp(-lft,mp(-rgt,-i)));
    }
    int cnt=0;
    int ses=0;
    while(!yo.empty())
    {

          pair<int,pi>cur=yo.top();
          yo.pop();
          int rgt=-cur.fi;
          int lft=-cur.si.fi;
          int idx=-cur.si.si;
          if(vis[idx])continue;
          vector<int>store;
          store.pb(idx);
          while(!yo.empty())
          {
              int tmp_rgt=-yo.top().fi;
              int tmp_idx=-yo.top().si.si;
              if(tmp_rgt==rgt)
              {
                  if(vis[tmp_idx]==0)store.pb(tmp_idx);
                  yo.pop();
              }
              else
              {
                  break;
              }
          }
          cnt=store.size();
          for(auto x:store)vis[x]=1;
          int bundle=cnt/c;
          ses+=bundle;
          int baki=cnt%c;
          if(baki==0)
          {
              continue;
          }
          baki=c-baki;
          while(!Magic.empty())
          {
              int tmp_lft=-Magic.top().fi;
              int tmp_rgt=-Magic.top().si.fi;
              int tmp_idx=-Magic.top().si.si;
              if(tmp_lft>rgt)break;
              if(baki<=0)break;
              if(vis[tmp_idx]==0)
              {
                   vis[tmp_idx]=1;
                   baki--;
              }
               Magic.pop();
          }
          ses++;

    }
    cout<<ses<<endl;
    return 0;

}






Measured memory_bytes: 6572
import java.util.Scanner;
import java.util.ArrayList;

public class Main{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String[] array ;
    array = sc.next().split("");
    int a = calc(array);
    System.out.println(a);
  }


  static int calc(String[] s){
    int count =0;
    int max = 0;
    for(int i=0; i<s.length;i++){
      if(s[i].equals("A") || s[i].equals("C")){
        count += 1;
      }else if(s[i].equals("T") || s[i].equals("G")){
        count += 1;
      }else{
        if(count>max){
          max = count;
        }
        count = 0;
      }
      if(count>max){
        max = count;
      }
    }
    return max;
  }


}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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

const int N = 1e2 + 2;

char T[N][N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);	
	
	int q = 50;
	int a, b; cin >> a >> b; a--, b--;
	for (int i = 0; i < q; i++) for (int j = 0; j < q + q; j++) T[i][j] = '.';
	for (int i = q; i < q + q; i++) for (int j = 0; j < q + q; j++) T[i][j] = '#';
	for (int i = 0; i < q - 1; i += 2) for (int j = 0; j < q + q && b > 0; j += 2, b--) T[i][j] = '#';
	for (int i = q + 1; i < q + q; i += 2) for (int j = 0; j < q + q && a > 0; j += 2, a--) T[i][j] = '.';
	cout << q + q << ends << q + q << endl;
	for (int i = 0; i < q + q; i++) {
		for (int j = 0; j < q + q; j++) cout << T[i][j];
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#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> P;
constexpr int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	vector<double> x(n), y(n);
	rep(i, n) cin >> x[i] >> y[i];
	double kai = 1.0;
	rep(i, n - 1) kai *= (i + 1);
	double sum = 0.0;
	rep(i, n - 1) {
		for (int j = i + 1; j < n; ++j) {
			double tmp = 0.0;
			tmp = 2.0*double(kai) * sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
			sum += tmp;
		}
	}
	double ans = sum / double(kai * n);
	cout << setprecision(10) << fixed << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
diffs = []
for i in range(m - 1):
    diffs.append([i, x[i + 1] - x[i]])
diffs = sorted(diffs, key=lambda x: -x[1])
diffs = list(map(lambda x: [x[0], x[0] + 1], diffs[:(n - 1)]))
diffs = [[0, 0]] + sorted(diffs) + [[(len(x) - 1), (len(x) - 1)]]
ans = 0
for i in range(len(diffs) - 1):
    ans += x[diffs[i + 1][0]] - x[diffs[i][1]]
print(ans)


Measured memory_bytes: 80552
/**
 * author  : UshanGhosh
 * created : 2020-09-19 18:04:04
**/ 

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

#define    ll      long long
#define    pii     pair<int,int>
#define    vii     vector<int>
#define    vcc     vector<char>
#define    pll     pair<long long, long long>
#define    mem     memset
#define    sof     sizeof
#define    co1     __builtin_popcountll
#define    PB      push_back
#define    UB      upper_bound
#define    LB      lower_bound
#define    MP      make_pair
#define    TS      to_string
#define    F       first
#define    S       second
#define    pi      acos(-1)
#define    mod     (int)1e9+7
#define    inf     (long long)1e18
#define    endl    '\n'

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long a,b,c,d,e,f,i,j,k,m,n,o,x,y;
    string s;
    cin>>s;
    n = s.size();
    cout<<s;
    if(s[n-1]=='s') cout<<"es\n";
    else cout<<"s\n";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
 
using namespace std;
#define rep(i,a,b) for (ll i = a; i < b; i++)
#define rrep(i,a,b) for (ll i = a; i >= b; i--)
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
 
using namespace std;
#define rep(i,a,b) for (ll i = a; i < b; i++)
#define rrep(i,a,b) for (ll i = a; i >= b; i--)
#define l(s) s.length()
#define sort(v) sort(v.begin(), v.end());
#define scan(v,n) rep(i,0,n) {ll k; cin >> k; v.pb(k);}
#define print(v,n) {rep(i,0,n) cout << v[i] << " "; cout << endl;}
#define printstr(s,n) {rep(i,0,n) cout << s[i]; cout << endl;}
#define rev(a) reverse(a.begin(), a.end());
#define pb push_back
typedef long long ll;
typedef long double lld;
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
 
const ll mxN=2e5;
const ll N=1e9+7;
 
int dp[mxN+1];
//dp[i] is 1, if the current player wins if there are i stones remaining
//dp[0]=0
//if(!dp[k]) rep(i,0,n) dp[k+v[i]]=1;
//continue till k==K

  int main() {
      int T=1;// cin >> T;
      while(T--){
          ll n, k; cin >> n >> k;
          vi v; scan(v,n);
          rep(i,0,k) {
              if(!dp[i]) {
                  rep(j,0,n) dp[i+v[j]]=1;
              }
          }
          cout << (dp[k]?"First":"Second");
      } 
	 return 0;
}


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

void solve(long long N, long long K, vector<long long> a){
  bool pls = false;
  long long sum = 0;
	for ( long long n : a ) {
    if ( n > 0 ) { pls = true; }
    sum += n;
  }
  if ( pls == false ) { printf("0\n"); return; }
  if ( a.size() <= K ) {
    if ( sum > 0 ) { printf("%lld\n", sum); return; }
    printf("0\n"); return;
  } else {
    vector<long long> candidates;
    long long ksum = 1414535963, psum = 0;
    for ( long long i = 0; i <= a.size() - K; i++ ) {
      if ( ksum == 1414535963 ) {
        ksum = 0;
        for ( long long j = i; j < i + K; j++ ) {
          ksum += a[j];
        }
        for ( long long j = 0; j < i; j++ ) {
          if ( a[j] > 0 ) psum += a[j];
        }
        for ( long long j = i + K; j < a.size(); j++ ) {
          if ( a[j] > 0 ) psum += a[j];
        }
      } else {
        ksum = ksum - a[i-1] + a[i+K-1];
        if ( a[i-1] > 0 ) {
          psum += a[i-1];
        }
        if ( a[i+K-1] > 0 ) {
          psum = psum - a[i+K-1];
        }
      }
      if ( ksum >= 0 ) {
        candidates.push_back(ksum + psum);
      } else {
        candidates.push_back(psum);
      }
    }
    printf("%lld\n", *std::max_element(candidates.begin(), candidates.end()));
  }

}

int main(){	
	long long K;
	long long N;
	scanf("%lld",&N);
	vector<long long> a(N-1+1);
	scanf("%lld",&K);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, K, a);
	return 0;
}



Measured memory_bytes: 2936
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
signed main() {
	int a, b; cin >> a >> b;
	if (a < 10 && b < 10)cout << a * b << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 256