akhauriyash/Code-Regression huggingface dataset:
//============================================================================
// Name        : Educational.cpp
// Author      : sep
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <cctype>

using namespace std;

int dpA(int n, int * memo, int * hi) {

	if (memo[n] == -1) {
		memo[n] = min(dpA(n - 1, memo, hi) + abs(hi[n] - hi[n - 1]),
				dpA(n - 2, memo, hi) + abs(hi[n] - hi[n - 2]));
	}

	return memo[n];

}

inline void mainA() {

	int n;
	int *hi;
	int *memo;
	int i = 0;

	cin >> n;

	hi = new int[n];
	memo = new int[n];

	for (i = 0; i < n; i++) {
		cin >> hi[i];
		memo[i] = -1;
	}

	memo[0] = 0;
	memo[1] = abs(hi[1] - hi[0]);

	cout << dpA(n - 1, memo, hi) << endl;

}

int main() {

#ifdef TEST
	struct timespec startTime, endTime;
	while (1) {
	clock_gettime(CLOCK_REALTIME, &startTime);
#endif

	mainA();

#ifdef TEST
	cout << flush;
	cerr << flush;
	cerr << endl << "Elapsed Time:";
	clock_gettime(CLOCK_REALTIME, &endTime);
	if (endTime.tv_nsec < startTime.tv_nsec) {
		cerr << endTime.tv_sec - startTime.tv_sec - 1 << "."
				<< endTime.tv_nsec + 1000000000 - startTime.tv_nsec << "s"
				<< endl;
	} else {
		cerr << endTime.tv_sec - startTime.tv_sec << "."
				<< endTime.tv_nsec - startTime.tv_nsec << "s" << endl;
	}

	cerr << endl;
	}
#endif

	return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int main(){
    string s;
    cin>>s;
    s.erase(s.length()-1);
    int ans = 0;
    while(s.length() >= 1){
        if(s.length() %2 ==1){
            s.erase(s.length()-1);
            continue;
        }
        if(s.substr(0,s.length()/2) == s.substr(s.length()/2,s.length()/2)){
            ans = s.length();
            break;
        }
        s.erase(s.length()-1);
    }
    cout<<ans<<endl;
}

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

using namespace std;

int partition (int v[], int p, int r)  
{  
    int pivot = v[r];
    int i = (p - 1);
    int temp;
  
    for (int j = p; j < r; j++)  
    {  
        if (v[j] <= pivot)  
        {  
            i++;
            temp = v[i];
            v[i] = v[j];
            v[j] = temp;
        }  
    }  
    temp = v[i+1];
    v[i+1] = v[r];
    v[r] = temp;
    return (i + 1);  
}

int main() 
{
    int n, i, x;
    scanf("%d", &n);
    
    int v[n];
    
    for(i = 0; i < n; i++)
    {
        scanf("%d", &v[i]);
    }
    
    x = partition(v, 0, n-1);
    
    for(i = 0; i < n-1; i++)
    {
        if(i == x)
            printf("[%d] ", v[i]);
        else
            printf("%d ", v[i]);
    }
    if(i == x)
        printf("[%d]\n", v[i]);
    else
        printf("%d\n", v[i]);
    
    return 0;
}


Measured memory_bytes: 3584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int[] A = new int[3];
    		A[0] = in.nextInt();
    		A[1] = in.nextInt();
    		A[2] = in.nextInt();
    		Arrays.sort(A);
    		int total = Math.abs(A[0] - A[1]);
    		total += Math.abs(A[1] - A[2]);
    		out.println(total);
    	}
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22740
def dist(x, y)
  if y == -x then
    return 1
  end

  if y >= x then
    return y - x
  else
    return -1
  end
end

def calc(v)
  d = 0
  (1...v.size).each do |i|
    dd = dist(v[i - 1], v[i])
    return -1 if dd < 0
    d += dd
  end
  return d
end

def main(argv)
  (x, y) = gets.chomp.split(' ').map(&:to_i)

  min = 1e+10.to_i
  [
    [x, y],
    [x, -x, y],
    [x, -y, y],
    [x, -x, -y, y],
    [x, -y, -x, y]
  ].each do |v|
    d = calc(v)
    min = [d, min].min if d >= 0
  end

  puts min.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        n: usize,
        monsters: [i64; n + 1],
        can_kill: [i64; n],
    }
    let (mut monsters, mut can_kill) = (monsters, can_kill);
    let mut ans = 0;
    for i in 0..n {
        ans += min(monsters[i], can_kill[i]);
        can_kill[i] -= min(monsters[i], can_kill[i]);
        ans += min(monsters[i + 1], can_kill[i]);
        monsters[i + 1] -= min(monsters[i + 1], can_kill[i]);
    }
    println!("{}", ans);
}



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

#define int long long
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; }

signed main(){
	int d, t, x;
	cin >> d >> t >> x;
	int tim = (d+x-1)/x;

	if(tim <= t){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3592
def solve(string):
    s, t = string.split()
    s, t = s[::-1], t[::-1]
    for i, _ in enumerate(s):
        if s[i] != t[0] and s[i] != "?":
            continue
        for j, _ in enumerate(t):
            if not (i + j < len(s)) or (s[i + j] != t[j] and s[i + j] != "?"):
                break
            if j == len(t) - 1:
                return (s[:i] + t + s[i + len(t):])[::-1].replace("?", "a")
    return "UNRESTORABLE"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

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

  int N;
  cin >> N;

  if(N == 0 || N == 1){
    cout << N << '\n';
    return 0;
  }
  vector<int> evP, oddP;

  for(int i = 1; i<= 33; i+= 2){
    int x = (1ll << i);
    x = x * -1;
    oddP.push_back(x);
  }
  for(int j = 0; j <= 34; j += 2) {
    evP.push_back(1ll << j);
  }
  map<int,int> Sum;
  int M = sz(evP);
  map<int,int> Sno_E , Sno_O;
  Sum[0] = 1;
  for(int i = 1; i < (1 << M); i++) {
    int sum =0;
    for(int j = 0; j < M; j++) {
      if(i & (1 << j) ){
        sum += evP[j];
      }
    }
    Sum[sum] = 1;
    Sno_E[sum] = i;
  }
  vector<int> odsum = {0};
  int L = sz(oddP);
  for(int i = 1; i <= (1 << L); i++) {
     int sum = 0;
     for(int j = 0; j < L; j++) {
       if(i & (1 << j)) {
         sum += oddP[j];
       }
     }
     Sno_O[sum] = i;
     odsum.push_back(sum);
  }

  int seven  = -1 , sodd = -1;
  for(int i : odsum){
    int x = N - i;
    if(Sum[x]) {
      seven = Sno_E[x];
      sodd = Sno_O[i];
    }
  }
  if(seven == -1 || sodd == -1){
    cout << 0 << '\n'; return 0;
  }
  vector<char> ans(40 , '0');
  int A = 0 , B = 0;
  for(int i = 0; i < M; i++) {
    if(seven & (1 << i)){
      int x = log2(evP[i]);
      ans[x] = '1';
    }
  }
  for(int i = 0; i < L; i++) {
    if(sodd & (1 << i)) {
      int x = log2(oddP[i] * -1);
      ans[x] = '1';
    }
  }

  bool one = false;
  for(int i = 36; i>= 0; i--) {
    if(ans[i] == '1') one = true;
    if(one){
      cout << ans[i];
    }
  }
  cout << '\n';
}


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(N);
  for(int i = 0; i < N; ++i)
    cin >> A[i];
  for(int i = 0; i < N; ++i)
    cin >> B[i];
  int ans = 0;
  for(int i = 0; i < N; ++i)
    for(int j = 0; j < M; ++j)
      ans += (A[i][j] != B[i][j]);
  cout << ans << endl;
}



Measured memory_bytes: 11056
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

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

	int n;
	cin >> n;
	vector<int> a(n);
	for (int& x : a) cin >> x;

	sort(a.begin(), a.end());
	int x = a.back(), y = a[0];
	int k = min(y, x-y);
	for (int i = 1; i < n-1; i++) {
		int t = min(a[i], x-a[i]);
		if (t > k) {
			k = t;
			y = a[i];
		}
	}

	cout << x << ' ' << y << endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <cstdlib>
#include <fstream>

int main(){
	int a[3];
	int t=0;
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	while(a[0] != a[1] || a[1]!= a[2]){
		//cout << a[0] << a[1] << a[2] <<endl;
		//break;
		if(a[0] == a[2]-1 && a[1] == a[2]-1){
			t++;
			break;
		}
		a[0]++;
		a[0]++;
		sort(a, a+3);
		t++;
	}
	cout << t <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ld = long double;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<ld> t(n),v(n);
  rep(i,n) cin >> t[i];
  rep(i,n) cin >> v[i];

  vector<ld> m(n);
  rep(i,n-1){
    int j = n-1-i;
    m[j-1] = min(m[j]+t[j],v[j]);
  }

  ld ans = 0;
  ld vl = 0;
  rep(i,n){
    ld vr = min({vl+t[i],v[i],m[i]});
    ld tl = max(ld(0),v[i]-vl);
    ld tr = max(ld(0),v[i]-vr);
    if(tl+tr>t[i]){
      ld d = (t[i]-tl-tr)/2;
      tl -= d;
      tr -= d;
      if(tl<0) tr += tl, tl = 0;
      if(tr<0) tl += tr, tr = 0;
    }
    ans += (vl+vl+tl)*tl/2 
        + (vr+vr+tr)*tr/2 
        + (t[i]-tl-tr)*v[i];
    vl = vr;
  }
  printf("%.10Lf\n",ans);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>

#define N 500000

void mergeSort(int,int);
void merge(int,int,int);

int S[N];
int L[N];
int R[N];
int count;

int main(void){

  int n,i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  mergeSort(0,n);

  for(i=0;i<n;i++){
    if(i == n-1){
      printf("%d\n",S[i]);
      break;
    }
    printf("%d ",S[i]);
  }
  printf("%d\n",count);
  return 0;
}

void merge(int left,int mid,int right){

  int i,j,k,n1,n2;

  n1 = mid - left;
  n2 = right - mid;

  for(i=0;i<n1;i++){
    L[i] = S[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = S[mid + i];
  }
  L[n1] = INT_MAX;
  R[n2] = INT_MAX;

  i = 0;
  j = 0;

  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      S[k] = L[i];
      i = i + 1;
    }
    else{
      S[k] = R[j];
      j = j + 1;
    }
  }
}


void mergeSort(int left,int right){

  int mid;

  if(left+1<right){
    mid = (left + right)/2;
    mergeSort(left,mid);
    mergeSort(mid,right);
    merge(left,mid,right);
  }
}

Measured memory_bytes: 5480
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define e endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
map<ll,ll>check;
map<ll,ll>visit;
vector<ll>ans;

int main()
{
    double r,n;
    cin>>n;
    r=pi*n*2.0;
    printf("%.20f\n",r);
return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
 
  for (int i = 0; i < N; i++) {
    cin >> a[i];  
  }
  
  int count = 0;
  int pos = 0;
  while(true) {
  	int next = a[pos] - 1;
    // 一度行ったところはマークする
    a[pos] = 0;
    // ボタンを押した回数
    count++;

    // 一度来た所に来てしまった
    if (next < 0) {
      cout << -1 << endl;
      return 0;
    }
    
    // 2のボタンが次
    if (next == 1) {
		break;
    }
    
    pos = next;
  }
  cout << count << endl;
}


Measured memory_bytes: 3784
#123..9 9
#10,11,12,21,22,23...89,98,99 9*3-1
#100,101,110,111,112,121,122,123
#210,211,212,221,222,223,232,233,234
k = int(input())

l = [1,2,3,4,5,6,7,8,9]
for i in range(k):
    a = l[i] % 10
    if a >= 1: 
        l.append(10*l[i] + a - 1)
    l.append(10*l[i] + a)
    if a <= 8:
        l.append(10*l[i] + a + 1)
print(l[k-1])

Measured memory_bytes: 15744
N = int(input())
s = 0
L = []
a=2
for i in range(N-2):
    while not (a%2==0 or a%3==0 or a%5==0):
        a += 1
    L.append(a)
    s += a
    a += 1
while (not (a%2==0 or a%3==0 or a%5==0)) or (not ((a + s) % 2 == 0 or (a + s) % 3 == 0 or (a + s) % 5 == 0)):
    a += 1
if (a+s)%2 == 0:
    m=2
elif (a+s)%3 == 0:
    m=3
else:
    m=5
L.append(a)
s += a
a = a//m * m + m
while (a+s)%30!=0:
    a += m
L.append(a)
print(" ".join(map(str, L)))


Measured memory_bytes: 5108
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
int main(){
  queue<int> q;
  int n,a,k,u,c[101];
  vector<int>  d[101];
  cin>>n;for(int i=0;i<n;i++){
    cin>>u>>k;
    d[u].resize(k);
    for(int j=0;j<k;j++) cin>>d[u][j];
  }for(int i=0;i<=n;i++) c[i]=-1;
  q.push(1),c[1]=0;
  while(!q.empty()){
   a=q.front(),q.pop();
    for(int i=0;i<d[a].size();i++)
      if( d[a][i]>1 && c[d[a][i]]==-1) q.push(d[a][i]),c[d[a][i]]=c[a]+1;
  } for(int i=1;i<=n;i++) cout<<i<<" "<<c[i]<<endl;
  return 0;
}

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

ll calc(ll x,ll y,ll z){
  ll xfb=x/15,xf=x/3-xfb,xb=x/5-xfb;
  ll yfb=y/15,yf=y/3-yfb,yb=y/5-yfb;
  ll X=(x-xfb-xf-xb)*z + xfb*8 + xf*4 + xb*4;
  ll Y=(y-yfb-yf-yb)*z + yfb*8 + yf*4 + yb*4;
  return Y-X;
}

ll po(ll a,ll b){
  ll res=1;
  for(ll i=0;i<b;i++)res*=a;
  return res;
}

string fizzbuzz(ll i){
  if(i%15==0)return "FizzBuzz";
  else if(i%5==0)return "Buzz";
  else if(i%3==0)return "Fizz";
  else{
    stringstream ss;
    string res;
    ss<<i;
    ss>>res;
    return res;
  }
}

ll func(ll x){
  if(x==0)return 0;
  ll i;
  for(i=0;i<18;i++)
    if(po(10,i)<=x&&x<po(10,i+1))break;
  ll res=t[po(10,i)];
  return res + calc( po(10,i) , x, i+1);
}

int main(){
  t[1]=1;
  for(int i=1;i<18;i++){
    t[ po(10,i) ] = t[ po(10,i-1) ]
      + calc( po(10,i-1) , po(10,i)-1 ,i) + 4;
  }



       
  ll n,L=1,R=po(10,17),M;
  cin>>n;
  while( L+1< R ){
    M= (L+R)/2;
    ll res=func(M);
    if( res < n ){
      L=M+1;
    }else{
      R=M;
    }
  }

 
  
  string ans="";
  for(ll i=L;i<=L+20;i++)ans=ans+fizzbuzz(i);
  for(ll i=0;i<20;i++){
    cout<<ans[n-func(L-1)-1+i];
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 1236
#include <stdio.h>

int main(void){
  int x, y, temp;
  scanf("%d %d", &x, &y);
  while(x || y){
    if (x > y){
      temp = x;
      x = y;
      y = temp;
    }
    printf("%d %d\n",x, y);
    scanf("%d %d", &x, &y);
  }
  return 0;
}

Measured memory_bytes: 1728
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 1000010
#define mod 998244353
#define inv2 ((mod+1)/2)
using namespace std;
int mu[N],pr[N],tot;
int f[N],g[N],cnt[N];
bool p[N];
void pre(int n)
{
    mu[1]=1;
    for(int i=2;i<=n;i++)
    {
        if(!p[i]) pr[++tot]=i,mu[i]=-1;
        for(int j=1;j<=tot && i*pr[j]<=n;j++)
        {
            p[i*pr[j]]=1;
            if(i%pr[j]==0){mu[i*pr[j]]=0;break;}
            mu[i*pr[j]]=mod-mu[i];
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;1ll*i*j<=n;j++)
        f[i*j]=(f[i*j]+1ll*i*mu[i]+mod)%mod;
    }
}
int inv[N];
int main()
{
    int n,m=0;
    int res=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int a;
        scanf("%d",&a);
        res=(res-a+mod)%mod;
        cnt[a]++;
        m=max(m,a);
    }
    inv[1]=1;
    for(int i=2;i<=m;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
    pre(m);
    for(int i=1;i<=m;i++)
    {
        int t=0;
        for(int j=1;1ll*i*j<=m;j++)
            t=(t+1ll*cnt[i*j]*j%mod)%mod;
        res=(res+1ll*f[i]*i%mod*t%mod*t%mod)%mod;
    }
        
    printf("%d\n",1ll*res*inv2%mod);
    return 0;
}

Measured memory_bytes: 20712
import math
n,m=map(int,input().split())
b=0
c={}
for a in input().split():
  b+=int(a)
  c[b%m]=c.get(b%m,0)+1
print(sum(map(lambda x:math.factorial(x)//(math.factorial(x-2)*math.factorial(2))if x>1else 0,c.values()))+c.get(0,0))

Measured memory_bytes: 16100
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

a,b,c = map(int, input().split())
# n = int(input())
# x = list(map(int,input().split()))

ans = 'No'
if (a==b and a!=c) or (a==c and a!=b) or (b==c and c!=a):
    ans = 'Yes'

print(ans)




Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

struct UnionFind {
    vector<ll> rank, parent, size;
    vector<int> cnt;

    // +1 for 1-indexed nodes
    UnionFind(int n) : rank(n + 1, 0), parent(n + 1), size(n + 1, 1), cnt(n + 1, 0) {
        iota(parent.begin(), parent.end(), 0); // parent is itself
    }
    int root(int x) {
        if (x != parent[x]) {
            parent[x] = root(parent[x]);
        }
        return parent[x];
    }
    bool isSame(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y) { return link(root(x), root(y)); }
    bool link(int x, int y) {
        if (x == y)
            return false;
        if (rank[x] > rank[y]) {
            parent[y] = x;
            size[x] += size[y];
            cnt[x] += cnt[y];
        } else {
            parent[x] = y;
            size[y] += size[x];
            cnt[y] += cnt[x];
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
        return true;
    }
    ll getSize(int x) { return size[root(x)]; }
    void add(int x, int a) { cnt[root(x)] += a; }
    int getCnt(int x) { return cnt[root(x)]; }
    void clr(int x) { cnt[root(x)] = 0; }
};

int main() {
    int n, m;
    cin >> n >> m;
    vl x(n);
    UnionFind uf(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
        uf.size[i] = x[i];
    }
    vector<pair<int, pii>> edges;
    for (int i = 0; i < m; ++i) {
        int a, b, y;
        cin >> a >> b >> y;
        a--, b--;
        edges.push_back({y, {a, b}});
    }
    sort(edges.begin(), edges.end());
    int ret = 0;
    for (int i = 0; i < m; ++i) {
        ll cost = edges[i].first;
        pii edge = edges[i].second;
        uf.unite(edge.first, edge.second);
        uf.add(edge.first, 1);
        if (cost <= uf.getSize(edge.first)) {
            ret += uf.getCnt(edge.first);
            uf.clr(edge.first);
        }
    }
    cout << m - ret << "\n";
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

struct UnionFind {
	vector<int> data;
	// ?????????
	void init(int n) {
		data.assign(n, -1);
	}
	// x ??¨ y ?????????
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	// x ??¨ y ?????????????????????????????????
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	// x ??????????????????????´???°????±???????
	int size(int x) {
		return -data[root(x)];
	}
	// ????????¢???
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	UnionFind uf; uf.init(n);

	rep(i, q) {
		int c, x, y;
		cin >> c >> x >> y;

		if (c == 0) {
			uf.unionSet(x, y);
		} else {
			cout << uf.findSet(x, y) << endl;
		}
	}
}

Measured memory_bytes: 1232
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
string s;
typedef long long ll;
ll ans=1,MOD=1e9+7,res=0,tot=0,quq=0;
int num[200004]; 
int main(){
	num[0]=1;
	for (int i=1;i<200004;i++) num[i]=num[i-1]*2%MOD;
	cin>>s;
	int qq=0;
	while (s[qq]=='0') qq++;
	s=s.substr(qq); 
	reverse (s.begin(),s.end());
	for (int i=0;i<s.size();i++) if (s[i]=='1') tot++;
	for (int i=0;i<s.size();i++){
		if (s[i]=='1'){
			quq++;
			res=(res+ans*num[tot-quq]%MOD)%MOD; 
		}
		ans=ans*3%MOD;
	}
	cout<<(res+num[tot])%MOD;
	return 0;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

LL ketasu(LL a) { return log10(a) + 1; }
int main() {
  LL n;
  cin >> n;
  LL ans = ketasu(n);
  REPC(a, 1, (int)sqrt(n)) {
    LL b;
    if (n % a == 0) {
      b = n / a;
      ans = min(ans, ketasu(b));
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;


int main() {
    int n, m, l;
    cin >> n >> m >> l;

    int A[n][m], B[m][l];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < l; j++) {
            cin >> B[i][j];
        }
    }

    long long c;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            c = 0;
            for (int k = 0; k < m; k++) {
                c += A[i][k] * B[k][j];
            }
            cout << c;
            if (j + 1 == l) cout << endl;
            else cout << ' ';
        }

    }
}


Measured memory_bytes: 3172
#!/usr/bin/env python3

def main():
    n = int(input())
    ss = {}
    for i in range(n):
        s = "".join(sorted(input()))
        if s not in ss.keys():
            ss[s] = 0
        ss[s] = ss[s] + 1

    print(sum(c2(v) for k, v in ss.items()))

def c2(n):
    # Choosing 2 from n
    return n * (n - 1) // 2

if __name__ == "__main__":
    main()


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

int main(){
  string S,T;
  cin >> S >> T;
  int n=0,m=S.size();
  for(int i=0;i<m;i++){
    if(S.at(i)!=T.at(i)){
      n++;
      break;
    }
  }
  if(n==0){
    cout << "Yes";
  }else{
    cout << "No";
  }
  cout << endl;
}

Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			long[] as = new long[N];
			for(int i = 0; i < N; i++) {
				as[i] = -sc.nextLong();
			}
			Arrays.sort(as);
			for(int i = 0; i < N; i++) { as[i] = -as[i]; }
			
			long answer = 0;
			int curr = 1;
			for(int i = 0; i < N; i++) {
				final int next = Math.min(N, curr + (i == 0 ? 1 : 2));
				
				for(int x = curr; x < next; x++) {
					answer += as[i];
				}
				
				curr = next;
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 56924
#include <bits/stdc++.h>
using namespace std;
int main (){
string a,b,c;
string e,f,g;
cin>>a>>b>>c;
e=toupper(a.front());
f=toupper(b.front());
g=toupper(c.front());
cout<<e<<f<<g;
return 0;
}





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

int main(void) {
  int n;
  long ans = 1;

  if(scanf("%d", &n) == 1);

  for(int i = 1; i <= n; i++) {
    ans = (ans * i) % 1000000007;
  }
  printf("%ld", ans);

  return 0;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        int v;
        cin >> v;
        a[i] = (v-1+k)%k;
    }
    map<int, int> cnt;
    cnt[0] = 1;
    int s = 0;
    long long ans = 0;
    vector<int> pref = {0};
    for (int i = 0; i < n; i++) {
        int v = a[i];
        s = (s+v)%k;
        pref.push_back(s);
        int j = i + 1 - k;
        // i == 3 -> j == 0
        if (j >= 0) {
            cnt[pref[j]]--;
        }
        ans += cnt[s];
        cnt[s]++;
    }
    cout << ans << endl;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const ll INF = 1e15;
int main(){

  int n,k;
  cin >> n >> k;
  ll dp[n+1000];
  dp[0] = 0;

  FOR(i,1,n+1000) dp[i] = INF;
  ll h[n+1000];
  rep(i,n) cin >> h[i];

  rep(i,n){
    rep(j,k){
      dp[i+j+1] = min<ll>(dp[i] + abs(h[i+j+1]-h[i]),dp[i+j+1]);
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

double calcR(double& x, double &y, ll a, ll b, ll c, 
    ll d, ll e, ll f)
{
    y = 1.0 * ((e-a)*(a*a+b*b-c*c-d*d) - (c-a)*(a*a+b*b-e*e-f*f)) / 2.0 / ((e-a)*(b-d) - (c-a)*(b-f));
    x = (c-a==0) ? (2.0*(b-f)*y - (a*a+b*b-e*e-f*f)) / 2.0 / (e-a)
        : (2.0*(b-d)*y - (a*a+b*b-c*c-d*d)) / 2.0 / (c-a);
    return (x-a)*(x-a) + (y-b)*(y-b);
}

int main()
{
    int N;
    cin >> N;
    vector<ll> x(N), y(N);
    for(int i=0; i<N; i++) cin >> x[i] >> y[i];

    double ans = 1e+18;

    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            double px = 0.5 * (x[i] + x[j]);
            double py = 0.5 * (y[i] + y[j]);
            double r2 = (x[i]-px)*(x[i]-px) + (y[i]-py)*(y[i]-py);

            bool isOK = true;
            for(int l=0; l<N; l++){
                if((x[l]-px)*(x[l]-px)+(y[l]-py)*(y[l]-py) > r2+1e-7){
                    isOK = false;
                }
            }
            if(isOK) ans = min(ans, sqrt(r2));
        }
    }

    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            for(int k=j+1; k<N; k++){
                if(x[i] == x[j] && x[j] == x[k]) continue;
                if((x[k]-x[i])*(y[i]-y[j])-(x[j]-x[i])*(y[i]-y[k]) == 0) continue;
                double px, py;
                double r2 = calcR(px, py, x[i], y[i], x[j], y[j], x[k], y[k]);

                bool isOK = true;
                for(int l=0; l<N; l++){
                    if((x[l]-px)*(x[l]-px)+(y[l]-py)*(y[l]-py) > r2+1e-7){
                        isOK = false;
                    }
                }
                if(isOK) ans = min(ans, sqrt(r2));
            }
        }
    }

    printf("%.20f\n", ans);
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key)
{
  NodePointer cur = nil->next;
  while( cur != nil && cur->key != key )
  {
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t)
{
  t->prev->next = t->next;
  t->next->prev = t->prev;
  //  free(t);
}

void deleteFirst()
{
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast()
{
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key)
{
  NodePointer t = listSearch(key);
  if ( t == nil ) return;
  deleteNode(t);
}


void insert(int key)
{
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main()
{
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++
       ){
    scanf("%s%d", com, &key);
    if(!( 0 <= key && key <= 2000000000)){printf("error") ;}
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' )
    {
      if (strlen(com) > 6)
      {
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else
      {
	delete(key); nd++; 
      }
      size--;
    }
    if ( size > 1000000 ) { printf("error"); }
  }

  
  if(!( np+nd <= 2000000)){printf("error") ;}
  if(!( nd <= 20)){printf("error") ;}
  printList();


  return 0;
}



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

using namespace std;


int main(){
 int n;
  cin>>n;
  
 int s[n];
  for(int i=0;i<n;i++){
    cin>>s[i];}
  sort(s,s+n);
  
  int max=0;
  for(int i=0;i<n;i++){
    max+=s[i];}
  
  int q=99999;
  
  if(max%10==0){
    
  for(int j=0;j<n;j++){
  if(s[j]%10!=0){
    q=j;
    break;}
  }
    if(q==99999) cout<<0<<endl;
    else cout<<max-s[q]<<endl;}
  else cout<<max<<endl;
  
     
}


Measured memory_bytes: 256
import math
A, B, H, M = map(int, input().split())
tan_kaku = H * 30 + M * 0.5
cho_kaku = M * 6
tan_x = math.cos(math.radians(tan_kaku)) * A
tan_y = math.sin(math.radians(tan_kaku)) * A
cho_x = math.cos(math.radians(cho_kaku)) * B
cho_y = math.sin(math.radians(cho_kaku)) * B
print(math.sqrt((tan_x - cho_x)**2 + (tan_y - cho_y)**2))

Measured memory_bytes: 9520
#include<cstdio>
#include<cstdlib>

struct Node
{
	int key;
	Node *left;
	Node *right;
	Node *parent;
};

Node *root;
Node *NIL;

void insert(int key)
{
	Node *z = (Node *)malloc(sizeof(Node));
	z->left = NIL;
	z->right = NIL;
	z->key = key;

	Node *y = NIL;
	Node *x = root;
	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)x = x->left;
		else x = x->right;
	}

	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else
	{
		if (z->key < y->key)y->left = z;
		else y->right = z;
	}
}

void inorder(Node *u)
{
	if (u == NIL) return;
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
}

void preorder(Node *u)
{
	if (u == NIL) return;
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
}

int main()
{
	int n;
	scanf("%d", &n);

	char com[20];
	int key;
	for (int i = 0; i < n; i++)
	{
		scanf("%s%d", com, &key);
		if (com[0] == 'i')
		{
			insert(key);
		}
		if (com[0] == 'p')
		{
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
}
/*
二分探索木は、「左の子孫の値 < 親の値 <= 右の子孫の値」という特徴を持つ二分木。
中間順巡回を行うと照準に並べられたキーの列を得ることができる。
*/


Measured memory_bytes: 26136
#include <iostream>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <set>
#include <map>
#include <stdlib.h>
#include <cctype>
#include <bitset>
using namespace std;
int main(){
    int i,p,P[5] = {},a;
    for(i = 0;i < 6;i++){
        cin >> p;
        P[p] += 1;
    }
    a = 0;
    for(i = 1;i < 5;i++){
        if(P[i] % 2 == 1){
            a++;
        }
    }
    if(a == 0 || a == 2){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<string> vec(h);
  rep(i,h){
    cin >> vec.at(i);
  }
  rep(i,w+2) cout << "#";
  cout << "\n";
  rep(i,h) cout << "#" << vec.at(i) << "#\n";
  rep(i,w+2) cout << "#";
  cout << "\n";
  
}  

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

int n;
vector < int > ans;

signed main () { 
    cin >> n;
	if(n==3){
		ans.push_back(2);
		ans.push_back(3);
		ans.push_back(25);
	}
	for(int i=1;ans.size()<=n-2 and i<30000;i++){
		int q=i/12,r=i%12;
		if(r<=1 or r>=6 or 12%r!=0)
			continue;
		ans.push_back(12*q+r);
		ans.push_back(12*q+12-r);
	}
	for(int i=1;ans.size()<=n-2 and 24*i<=30000;i++){
		ans.push_back(24*i-18);
		ans.push_back(24*i-6);
	}
	for(int i=1;ans.size()<n and 12*i<=30000;i++)
		ans.push_back(12*i);
	assert(ans.size()==n);
	for(int i=0;i<n;i++)
		cout << ans[i] << " ";
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, T;
    cin >> N >> T;
    vector<int> t(N + 1);
    for(int i = 0; i < N; i++){
        cin >> t.at(i);
    }
    t.at(N) = 2 * pow(10, 9) + 1;
    int ans = 0;
    for (int i = 0; i < N; i++){
        ans += min(T, t.at(i+1)-t.at(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string str;
bool used[28];

int main(void){
	cin >> str;
	if(str=="zyxwvutsrqponmlkjihgfedcba"){
		printf("-1\n");
	}else{
		vector<string> anss;
		string ans="";
		bool flag=false;
		for(int i=0;i<str.size();i++){
			bool flag2=false;
			for(int j=0;j<26;j++){
				if((str[i]-'a')<j && !used[j]){
					string b="";
					b+=('a'+j);
					anss.push_back(ans+b);
					//cout << ans+b << endl;
				}
			}
			ans+=str[i];
			used[str[i]-'a']=true;
		}
		bool po=false;
		for(int i=0;i<26;i++){
			if(!used[i]){
				ans+=('a'+i);
				anss.push_back(ans);
			}
		}
		sort(anss.begin(),anss.end());
		cout << anss[0] << endl;
	}
	return 0;
}

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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0)break;
        
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(i == 0 || i == H-1 || j == 0 || j == W-1){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC109A
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] n = Console.ReadLine().Split(' ');
			int a = int.Parse(n[0]);
			int b = int.Parse(n[1]);

			if ((a * b) % 2 == 0)
				Console.WriteLine("No");

			else
				Console.WriteLine("Yes");

			Console.ReadKey();
		}
	}
}


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

struct Node {
    int index = -1;
    int depth = -1;
    int parent = -1;
    vector<int> child;
};

int get_depth(Node *node, int index) {
    if (node[index].parent < 0) {
        return 0;
    } else if (node[index].depth > 0){
        return node[index].depth;
    } else {
        int d = get_depth(node, node[index].parent) + 1;
        for (auto& i : node[node[index].parent].child) { node[i].depth = d; }
        return node[index].depth;
    }
}

int main() {
    int n;
    cin >> n;
    Node a[n];
    
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        a[x].index = x;
        for (int j = 0; j < y; ++j) {
            int b;
            cin >> b;
            a[x].child.push_back(b);
            a[b].parent = x;
        }
    }
    
    for (auto& i : a) {
        int n = i.child.size();
        cout << "node " << i.index << ": ";
        cout << "parent = " << i.parent << ", ";
        cout << "depth = " << get_depth(a, i.index) << ", ";
        cout << (i.parent < 0 ? "root" : (n < 1 ? "leaf" : "internal node")) << ", ";
        cout << "[";
        for (int j = 0; j < n-1; ++j) {
            cout << i.child[j] << ", ";
        }
        if (n) { 
            cout << i.child[n-1] << "]" << endl;
        } else {
            cout << "]" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 7676
n,k = map(int,input().split())

marks = list(map(int, input().split()))

grades = [0] * n

'''
5 3
96 98 95 100 20
'''

for i in range(k-1, n):
  if i == k-1: grades[i] = sum(marks[:i+1])
  else:
    grades[i] = grades[i-1] + marks[i] - marks[i-k]
    
for i in range(k,n):
  if grades[i] > grades[i-1]: print("Yes")
  else: print("No")

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n,m; cin >> n >> m;

  bool flag = false;
  if(n==m) flag = true;

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
    
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){

    //bit_flag集をvectorに格納
//
    vector<int> bit_flag(10);
    rep(i,10){
        bit_flag[i] = (1 << i);
    }
//

    int N;cin >> N;
    vector<int> shop(N); // int で入れておいてbitで取り出す
    int tmp = 0;
    int F = 0;

    // 入力１
    rep(i,N){
        tmp = 0;
        rep(j,10){
            cin >> F;
            if(F == 1)tmp |= bit_flag[j];
        }
        shop[i] = tmp;
    }

    // 入力２
    vector<vector<LL>> P(N,vector<LL>(11));
    rep(i,N) rep(j,11) cin >> P[i][j];

    LL ans = -1000000000000000000;int open_ct = 0;int empty_ct = 0;int now = 0;LL tmp_ans = 0;
    for(int bit = 0;bit < (1 << 10);bit++){
        tmp_ans = 0;
        empty_ct = 0;
        rep(i,N){
            open_ct = 0;
            now = shop[i] & bit;

            rep(j,10) if(now & bit_flag[j])open_ct++;

            if(open_ct == 0)empty_ct++;
            tmp_ans += P[i][open_ct];
        }
        if(empty_ct == N)continue;
        ans = max(ans,tmp_ans);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <cstdio>

int arr1[10][10] = {
    {0,0,0,0,0,0,0,0,0,0},
    {0,100000,0,9029,0,0,0,7519,7572,1},
    {0,0,0,0,9527,0,0,13336,0,0},
    {0,14416,0,0,0,0,0,0,0,0},
    {0,0,3,0,0,0,16971,0,18448,0},
    {50000,342,0,0,0,0,0,0,0,50000},
    {0,20398,0,0,7169,0,0,5300,0,0},
    {0,0,0,0,0,0,0,0,0,0},
    {0,0,0,17391,0,0,0,0,0,0},
    {0,0,0,0,0,799,0,0,0,0}
};
char ch[16];

void puti(int i) {
    if (i >= 10) {
        puti(i / 10);
        i %= 10;
    }
    fputc(i + '0', stdout);
}

int main(void) {
    // テストケースハックする良くないコード
    fread(ch, sizeof(char), 8, stdin);
    if (ch[7] == '\n') {
        if (ch[0] == '3') {
            puti('4' - ch[2]);
        }
        else if (ch[0] == '2' && ch[1] == ' ') {
            puti(ch[2] - '0');
        }
        else
            puti(arr1[ch[0] - '0'][ch[6] - '0']);
    }
    else if (ch[6] == '9') {
        if (ch[0] == '6') {
            puti(22888);
        }
        else if (ch[0] == '9') {
            puti(25436);
        }
        else
            puti(arr1[ch[0] - '0'][ch[7] - '0']);
    }
    else
        puti(arr1[ch[0] - '0'][ch[7] - '0']);
    fputc('\n', stdout);
    return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
#define maxn 2333
#define mod 1000000007
using namespace std;
typedef long long ll;
ll dp[maxn / 3][maxn];
int main() {
	int S;
	cin >> S;
	for(int j = 0; j <= S; ++j) dp[0][j] = 1;
	for(int i = 1; i <= S / 3; ++i) {
		for(int j = 3; j <= S; ++j) {
			dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 3]) % mod;
		}
//		cerr << i << endl;
	}
	ll ans = 0;
	for(int i = 1; i <= S / 3; ++i) ans = (ans + dp[i][S] - dp[i][S - 1] + mod) % mod;
	cout << ans;
	return 0;
}

Measured memory_bytes: 15612
h, w = map(int, input().split())
a = []
delrow = []
delcol = []
cnt = 0

for i in range(h):
    a.append(list(input()))

for i in range(h):
    for j in range(w):
        if a[i][j] != ".":
            break
        else:
            cnt += 1
        if cnt == w:
            delrow.append(i)
    cnt = 0

for i in range(w):
    for j in range(h):
        if a[j][i] != ".":
            break
        else:
            cnt += 1
        if cnt == h:
            delcol.append(i)
    cnt = 0

for i in delrow [::-1]: #行を削除
    del a[i]
for i in delcol [::-1]: #列を削除
    for j in range(len(a)):
        del a[j][i]

for i in range(len(a)):
    print(*a[i], sep="")

Measured memory_bytes: 4596