akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#define _CRT_SECURE_SECURE_WARNINGS
using namespace std;

int main() {
	int p, s, m[101] = {}, m_b, w_b, d_b, m1, m2, w1, w2, d1, d2, n, w[101] = {}, d[101] = {};
	while (1) {
		cin >> n >> w[0] >> d[0];
		if (n == 0 && w[0] == 0 && d[0] == 0)
			break;
		m[0] = w[0] * d[0];
		for (int i = 0; i < n; i++) {
			cin >> p >> s;
			p--;
			s = s % (2 * w[p] + 2 * d[p]);
			m_b = m[p];
			w_b = m[p];
			d_b = d[p];
			if (s < w[p]) {
				w1 = s;
				w2 = w[p] - w1;
				d1 = d[p];
				d2 = d[p];
			}
			if (w[p] < s&&s < w[p] + d[p]) {
				w1 = w[p];
				w2 = w[p];
				d1 = s - w[p];
				d2 = d[p] - d1;
			}
			if (w[p] + d[p] < s&&s < 2 * w[p] + d[p]) {
				w1 = s - w[p] - d[p];
				w2 = w[p] - w1;
				d1 = d[p];
				d2 = d[p];
			}
			if (2 * w[p] + d[p] < s&&s < 2 * (w[p] + d[p])) {
				w1 = w[p];
				w2 = w[p];
				d1 = s - 2 * w[p] - d[p];
				d2 = d[p] - d1;
			}
			m1 = w1 * d1;
			m2 = w2 * d2;
			for (int j = p; j <= i; j++) {
				m[j] = m[j + 1];
				w[j] = w[j + 1];
				d[j] = d[j + 1];
			}

			if (m1 < m2) {
				m[i] = m1;
				w[i] = w1;
				d[i] = d1;
				m[i + 1] = m2;
				w[i + 1] = w2;
				d[i + 1] = d2;
			}
			else {
				m[i] = m2;
				w[i] = w2;
				d[i] = d2;
				m[i + 1] = m1;
				w[i + 1] = w1;
				d[i + 1] = d1;
			}
		}

		int min = -1, f;
		for (int i = 0; i <= n; i++) {
			min = -1;
			for (int j = 0; j <= n; j++) {
				if ((m[j] < m[min] || min == -1) && m[j] != -1)
					min = j;
			}
			if (min > -1) {
				cout << m[min];
				m[min] = -1;
			}

			if (i == n)
				cout << "\n";
			else
				cout << " ";

		}
	}
	return 0;
}



Measured memory_bytes: 3052
#include <stdio.h>

int main(void) {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(0<=x-r && x+r<=W && 0<=y-r && y+r<=H)
    printf("Yes\n");
  else
    printf("No\n");  
  return 0;
}


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

int judge(int x) {
  x <= 7 ?
    x == 2 ? x = 3 : x % 2 == 0 ? x = 2 : x = 1
      :
  x % 2 == 0 ? x = 1 : x = 2;
  return x;
}
      
int main() {
  int x, y;
  cin >> x >>  y;
  judge(x) == judge(y) ? cout << "Yes" << endl : cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 1e5 + 10;
int N;
int A[MAX];
VI graph[MAX];
int memo[MAX];
VI v;
VI v2;

int dfs(int now) {
    if (memo[now] != -1) return memo[now];
    int res = 0;
    VI vv;
    FORE(e, graph[now]) {
        vv.EB(dfs(e));
    }
    RSORT(vv);
    REP(i, vv.size()) vv[i] += i + 1;
    FORE(e, vv) chmax(res, e);
    return memo[now] = res;
}

int main(void) {
    memset(memo, -1, sizeof(memo));
    scanf("%d", &N);
    A[0] = -1;
    FOR(i, 1, N) {
        scanf("%d", &A[i]);
        A[i]--;
        if (A[i] == 0) v.EB(i);
        graph[A[i]].EB(i);
    }
    int ans = v.size();
    FORE(e, v) v2.EB(dfs(e));
    RSORT(v2);
    REP(i, v2.size()) v2[i] += i + 1;
    FORE(e, v2) chmax(ans, e);
    cout << ans << endl;
}


Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
#define ll long long

int main(void){
  string str;
  cin >> str;
  int num = str.size();
  vector<int> ans(num,0);
  int p = 0;
  for(int i = 0;i < num;i ++){
    if(str[i] == 'R'){
      p ++;
    }else{
      if(p>0){
        ans[i] = ans[i]  +floor(p/2);
        ans[i-1] = ans[i-1] + floor(p/2) + (p % 2);
      }
      p = 0;
    }
  }
  p = 0;
  for(int i = 0;i < num;i ++){
    if(str[num-1-i] == 'L'){
      p++;
    }else{
      if(p>0){
        ans[num-i-1] = ans[num-i-1] + floor(p/2);
        ans[num-i] = ans[num-i] + floor(p/2) + (p % 2);
      }
      p = 0;
    }
  }
  for(int i = 0;i < num;i ++){
    cout << ans[i] << ' ';
  }
  
  
  return 0;
}

Measured memory_bytes: 3852
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
int a[300000];
int main() {
	int N;
	cin >> N;
	rep(i, 3 * N) cin >> a[i];
	sort(a, a + 3 * N);
	int r = 3 * N - 1;
	int l = 0;
	LL ans = 0;
	rep(i, N) {
		r--;
		ans += a[r];
		r--;
		l++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1408
let m a b = a mod b + if a mod b < 0 then abs b else 0
let rec f n a = if n = 0 then a else f ((n - m n ~-2) / -2) (m n ~-2 :: a)
let _ = print_newline @@ match f (read_int ()) [] with [] -> print_int 0 | a -> List.iter print_int a

Measured memory_bytes: 384
#include <stdio.h>

int main() {
	int k;
	scanf("%d", &k);
	int odd = 0, even = 0;
	for(int i = 1; i <= k; i++){
		if(i%2 == 0)
			even++;
		else
			odd++;
	}
	int cont = even*odd;
	printf("%d\n", cont);



	return 0;
}

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

int main()
{
  int D;
  string str;
  cin >> D;
  switch (D)
  {
  case 25:
    str = "Christmas";
    break;
  case 24:
    str = "Christmas Eve";
    break;
  case 23:
    str = "Christmas Eve Eve";
    break;
  case 22:
    str = "Christmas Eve Eve Eve";
    break;
  }
  cout << str << endl;
  return 0;
}

Measured memory_bytes: 888
#include <stdio.h>

int main(void){
  char S[10] = {};
  int i, j, k;
  int price = 700;
  scanf("%s", S);
  for(i = 0; i < 3; i++){
    if(S[i] == 'o'){
      price += 100;
    }
  }
  printf("%d\n", price);
  return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;

/**
 * Created by Ayushi on 21 Jun 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        StringTokenizer st;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer(br.readLine(), " ");
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine(), " ");
        int[] a = new int[n];
        int j = 0;
        while (st.hasMoreTokens()) {
            a[j] = Integer.parseInt(st.nextToken());
            j++;
        }
        br.close();
        int ans = 0;
        Arrays.sort(a);
        for (int i = 0; i < k; i++) {
            ans += a[i];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 32940
#include<iostream>
using namespace std;
typedef long long ll;

ll number[101];

int main() {
    int N;
    ll max_abs = 0;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> number[i];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i == j) continue;
            if (max_abs < abs(number[i] - number[j])) max_abs = abs(number[i] - number[j]);
        }
    }
    cout << max_abs << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long n = in.nextLong();
			char[] t = String.valueOf(n).toCharArray();
			long wa = 0;
			for (char c : t) {
				wa += (int)(c-'0');
			}

			out.println(n % wa == 0 ? "Yes" : "No");

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 23508
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    long long int n,ans=LLONG_MAX,x=0;
    cin>>n;
    vector<long long int>a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long int sum=accumulate(a.begin(),a.end(),0LL);
    for(int i=0;i<n;i++){
        x+=a[i];
        if(i+1<n)ans=min(ans,abs(sum-2*x));
    }
    cout<<ans;
}

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

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      Graph graph = new Graph(n);
      String[] vInfo;
      int[][] weight = new int[n][n];

      for(int i=0, j=0; i<n; i++, j=0) {
        vInfo = br.readLine().split(" ");
        for (String var : vInfo) {
          if(var.equals("")) continue;
          else weight[i][j++] = Integer.parseInt(var);
        }
        graph.setVertex(i, weight[i]);
      }

      System.out.println( graph.calcMSTWeightSum() );
    }
    catch (IOException e) {
      System.err.println(e);
    }
  }


  class Graph {

    Vertex[] vertices;

    public Graph(int size ) {
      vertices  = new Vertex[size];
    }

    public void setVertex(int id) {
      vertices[id] = new Vertex(id);
    }
    public void setVertex(int id, int[] distance) {
      setVertex(id);
      setAjacent(id, distance);
    }
    public void setAjacent(int id, int[] distance) {
      vertices[id].distance = distance;
    }

    public int calcMSTWeightSum() {
      return  prim();
    }

    private int prim() {
      int minCost;
      int minV;
      vertices[0].minAjacent = 0;
      vertices[0].parent = -1;

      while( true ) {
        minCost = Integer.MAX_VALUE;
        minV = -1;

        for (Vertex v : vertices) {
          if( (v.state != Vertex.BLACK) && (v.minAjacent < minCost) ) {
            minV = v.id;
            minCost = v.minAjacent;
          }
        }

        if(minV == -1) break;

        vertices[minV].state = Vertex.BLACK;

        for (Vertex v : vertices) {
          if((v.state != Vertex.BLACK) && (v.distance[minV] != -1)) {
            if( v.distance[minV] < v.minAjacent ) {
              v.minAjacent = v.distance[minV];
              v.parent = minV;
              v.state = Vertex.GRAY;
            }
          }
        }
        continue;
      }

      minCost = 0;
      for (Vertex v: vertices) {
        if( v.parent != -1 )
          minCost += v.minAjacent;
      }

      return minCost;
    }

    class Vertex {

      static final int WHITE = 0;
      static final int GRAY  = 1;
      static final int BLACK = 2;
      int id;
      int state;
      int minAjacent;
      int parent;
      int[] distance;

      public Vertex(int id) {
        this.id = id;
        state = WHITE;
        minAjacent = Integer.MAX_VALUE;
      }
    }
  }
}


Measured memory_bytes: 27140
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}
ll ans;
int main(void){
    ans = 1;
    ll n; cin >> n;
    for (ll i = 1; i <= n; ++i) { 
        ans *= i;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	int n;
	cin>> n;
	if(!n) return false;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>> a[i];
	}
	string str;
	cin>> str;
	
	for(int i=0;i<str.size();i++){
		int k = a[i%n];
		k %= 52;
		char c = str[i];
		if(k>26){
			if(islower(c)){
				c = toupper(c);
			}else{
				c = tolower(c);
			}
			k -= 26;
		}
		if(islower(c)){
			if(islower(c-k)){
				c -= k;
			}else{
				k -= c - 'a';
				c = 'Z' - (k - 1);
			}
		}else if(isupper(c)){
			if(isupper(c-k)){
				c -= k;
			}else{
				k -= c - 'A';
				c = 'z' - (k - 1);
			}
		}
		cout<< c;
	}
	cout<< endl;

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	while(solve()){}

	return 0;
}

 

Measured memory_bytes: 1204
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> s = new List<int>();
    static decimal result;
static Hashtable ht=new Hashtable();
static int N,M;
static long[,] table;
    static void Main()
    {
Read1();
      if(M==1){ Console.WriteLine(result.ToString());return;}
      result=N-M;
                    Console.WriteLine(result.ToString());

    }

    static void Read1()
    {
        string[] tmp = Console.ReadLine().Split();
        N = int.Parse(tmp[0]);
      M=int.Parse(tmp[1]);
    }

    static void Read2(int kosuu)
    {
        string[] tmp = Console.ReadLine().Split(' ');
        for (int i = 0; i < kosuu; i++) { s.Add(int.Parse(tmp[i])); }
    }

}

Measured memory_bytes: 11220
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define LL long long
#define NUM 1000000007

using namespace std;

int main()
{
    map<char,int> m;
    string tmp;
    cin >> tmp;
    for (size_t i = 0; i < tmp.length(); i++)
    {
        m.insert(make_pair(tmp[i], 0));
    }
    for (size_t i = 0; i < 26; i++)
    {
        if (m.find((char)(97 + i)) == m.end())
        {
            cout << (char)(97 + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
l = [list(map(int,input().split())) for i in range(3)]
n = int(input())
a = []
for i in range(n):
    s = int(input())
    a.append(s)
ans = [[0]*3 for i in range(3)]

for j in range(3):
    for k in range(3):
        if l[j][k] in a:
            ans[j][k] = 1

for i in ans:
    if sum(i) == 3:
        print("Yes")
        exit()
for i in range(3):
    count = 0
    for j in range(3):
        if ans[j][i] == 1:
            count += 1
    if count == 3:
        print("Yes")
        exit()
if ans[0][0] == ans[1][1] == ans[2][2]==1:
    print("Yes")
    exit()
if ans[0][2] == ans[1][1] == ans[2][0] == 1:
    print("Yes")
    exit()
print("No")



Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

int main() {

	int n;
	cin >> n;
	n--;

	ll ans;
	cin >> ans;
	FOR(i, n) {
		ll t;
		cin >> t;
		ans = lcm(ans, t);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
s, t = [], []
for n in range(N):
  s.append(input())

M = int(input())
for m in range(M):
  t.append(input())

name_union = set(s) | set(t)
money = {}
for i, n in enumerate(name_union):
  money.setdefault(n, 0)
  money[n] += sum(map(lambda x: 1 if x == n else 0, s))
  money[n] -= sum(map(lambda x: 1 if x == n else 0, t))
#print(money)
#print(money.values())
print(0 if max(money.values()) < 0 else max(money.values()))

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

int fgcd(int a, int b) {
  // a>b
  if (a%b==0) return b;
  return fgcd(b, a%b);
}

int main() {
  int k;
  cin >> k;
  long long ans=0;
  for (int x=1; x<=k; ++x) {
    for (int y=x; y<=k; ++y) {
      for (int z=y; z<=k; ++z) {
        if (x==y && y==z) ans+=x;
        else if (x==y) ans+=3*fgcd(z, x);
        else if (y==z) ans+=3*fgcd(y, x);
        else ans+=6*fgcd(z, fgcd(y, x));
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[]) {
  string s,t,password;
  cin>>s;
  cin>>t;
  for(int i;i<s.size()-1;i++){
    password+=s[i];
    password+=t[i];
  }
  if(s.size()==t.size()){
    password+=s[s.size()-1];
    password+=t[t.size()-1];
  }else{
    password+=s[s.size()-1];
  }
  cout<<password<<endl;
  return 0;
}


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

int main(int argc, void **argv)
{
	int x[5];
	int k;
	int i;
	bool ret = true;

	for (i = 0; i < 5; i++)
	{
		scanf("%d", &x[i]);
	}
	scanf("%d", &k);

	for (i = 0; i < 5-1; i++)
	{
		for (int j = i+1; j < 5; j++)
		{
			if( (x[j] - x[i]) > k )
			{
				ret = false;
				break;
			}
		}
	}

	if( ret )	puts("Yay!");
	else		puts(":(");

	return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"bufio"
	"strconv"
	"os"
)

// assume that x >= y
func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	x, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	y, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	fmt.Println(gcd(x, y))
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}


Measured memory_bytes: 1092
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    if(N % 2 == 0){
        print((N-2)/2);
    }else{
        print((N-1)/2);
    }
    
    

}

Measured memory_bytes: 256
# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 27/06/2020

from sys import stdin,stdout
from math import gcd, ceil, sqrt
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

a = ii1()
print(a + a ** 2 + a ** 3)


Measured memory_bytes: 9084
#include <iostream>
#include <cstdio>

unsigned long calc_gcd(unsigned long a, unsigned long b) {

  while(b != 0) {
    unsigned long c = b;
    b = a % b;
    a = c;
  }
  return a;
}

int main() {
  unsigned long a,b;

  while(scanf("%ld %ld", &a, &b) != EOF) {
    unsigned long gcd = calc_gcd(a, b);
    std::cout << gcd << " " << a*b/gcd << std::endl; 
  }
}

Measured memory_bytes: 3112
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
 
int main() {
    int x, a, b;
    cin >> x >> a >> b;
 
    cout << (x-a)%b;
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N,K;
  cin>>N>>K;
  VI A(N);
  rep(i,N) cin>>A[i];
  vector<ll> B(N+1);
  rep(i,N){
    B[i+1]=(B[i]+A[i]+K-1)%K;
  }
  map<int,int> M;
  int cnt=0;
  rep(i,N+1){
    if(M.count(B[i])==0){
      M[B[i]]=cnt;
      cnt++;
    }
  }
  VI C(M.size());
  ll ans=0;
  rep(i,N+1){
    if(i>=K){
      C[M[B[i-K]]]=max(0,C[M[B[i-K]]]-1);
    }
    ans+=C[M[B[i]]];
    C[M[B[i]]]++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const int MX = 100001;
int n,a,b,m,ans[MX];
vector<P> G[MX];
void dfs(int now, int parent, int pcolor){
	int ncolor = 1;
	for(P nowx: G[now]){
		if(nowx.first != parent){
			if(ncolor == pcolor) ncolor++;
			ans[nowx.second] = ncolor;
			dfs(nowx.first,now,ncolor);
			ncolor++;
		}
  	}
}
int main(){
	scanf("%d", &n);
	rep(i,n-1){
		scanf("%d%d", &a, &b); a--; b--;
		G[a].push_back(P(b,i));
		G[b].push_back(P(a,i));
	}
	rep(i,n) m = max(m,(int)G[i].size());
	dfs(0,0,0);
	printf("%d\n", m);
	rep(i,n-1) printf("%d\n", ans[i]);
}


Measured memory_bytes: 9344
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    if (N % 2 == 1) {
        cout << 0 << endl;
        return 0;
    } else {
        ll sum = 0;
        ll base = 5;
        ll n = N;
        while (n >= base) {
            sum += (n / base) / 2;
            base *= 5;
        }

        cout << sum << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 100000000000000
#define endl '\n'
int main()
{
	fastio;
	#ifdef gdb_18
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n;
	cin>>n;
	string s;
	getline(cin,s);
	getline(cin,s);
	ll cnt=0;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='W')
			cnt++;
	}
	if(cnt==n || cnt==0)
		cout<<0<<endl;
	else
	{
		ll ans=0;
		for(ll i=n-1-cnt;i>=0;i--)
		{
			if(s[i]=='W')
				ans++;
		}
		cout<<ans<<endl;
	}
	return 0;	
}

Measured memory_bytes: 3736
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N;
	ll ans_a = 0LL;
	// ll ans_b = 0LL;
	cin>>N;
	vector<ll> in(N);
	rep(i,N)cin>>in[i];
	rep(i,N){
		if(in[i] == i+1 && in[i+1] == i+2){
			ans_a ++;
			in[i] = i+2; in[i+1] = i+1;
		}	
	}
	rep(i,N){
		if(i%2 == 0){
			if(in[i] == i+1 || in[i+1] == i+2)ans_a ++;
		}
	}
	cout<<ans_a<<endl;
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	list := strings.Split(s, "")
	cnt := len(s)
	result := 0
	for i := 0; i < int(cnt/2); i++ {
		if list[i] != list[cnt-1-i] {
			result++
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 640
import sys

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


def main():
    S = input()
    print(S[:4] + ' ' + S[4:])


if __name__ == '__main__':
    main()


Measured memory_bytes: 8960
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		String x = input.nextLine();
		boolean lucky = true;
		for (int i = 0; i < x.length(); i++) {
			if (x.charAt(i)=='7') {
				lucky = false;
				break;
			}
		}
		if (lucky) System.out.println("No");
		else System.out.println("Yes");
	}

}

Measured memory_bytes: 27008
/*
    B - Foods Loved by Everyone
    https://atcoder.jp/contests/abc118/tasks/abc118_b
*/
#include <bits/stdc++.h>
using namespace std;

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

    int n, m;
    cin >> n >> m;
    int like[30] = {0};

    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int i = 0; i < k; i++) {
            int kind;
            cin >> kind;
            like[kind - 1] += 1;
        }
    }

    int sum = 0;
    for (int i = 0; i < m; i++) {
        // cout << "like : " << like[i] << endl;
        if (like[i] >= n)
            sum++;
    }
    cout << sum << endl;
}

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

int main(){
    int n;
    cin >> n;
    rep(i,n){
        int a;
        cin >> a;
        if(a%2 == 0){
            if(a%3 != 0 && a%5 !=0){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
 
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    
    std::tm time;
    std::cin >> std::get_time(&time, "%Y/%Om/%Od");
    ++time.tm_year;
    std::cout << std::put_time(&time, "%Y/%Om/%Od");
}


Measured memory_bytes: 384
from scipy.sparse.csgraph import floyd_warshall, csgraph_from_dense
import sys
input = sys.stdin.readline

h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]

G = csgraph_from_dense(c)
d = floyd_warshall(G).astype(int)

ans = 0

for l in a:
    for ai in l:
        if ai == -1:
            continue
        ans += d[ai][1]

print(ans)




Measured memory_bytes: 38200
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N;
    cin >> N;
    constexpr ll array_size = 100001LL;
    array<ll, array_size> counts;
    counts.fill(0LL);
    for (auto &&i: boost::irange(0LL, N)){
        ll a;
        cin >> a;
        counts.at(a)++;
    }
    ll count{0};
    ll duplicate_count{0};
    for (auto &&i: boost::irange(0LL, array_size)){
        if (counts.at(i) != 0){
            count++;
            if (counts.at(i) % 2 == 0){
                duplicate_count++;
            }
        }
    }
    if (duplicate_count % 2 == 0){
        cout << count;
    }else {
        cout << count - 1;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;
#define DUMPR(v) REP(_i,v.size()){std::cerr<< #v << "[" << _i << "] = " << (v[_i]) << std::endl;}
#define CIN_VEC(v,N) {v.clear(); v.reserve(N); REP(i,N){typename decltype(v)::value_type x; cin>>x; v.emplace_back(x);}};

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

static const int NMAX = 100;
static const int WMAX = 100000;
int w[NMAX];
int v[NMAX];
int N,W;

// dp[i+1][j] ... 品物iまでを使って重量j以下のときの価値の最大値
long long dp[NMAX+1][WMAX+1];

int main() {
  cin>>N>>W;
  REP(i,N) cin>>w[i]>>v[i];
  memset(dp, 0, sizeof(dp));

  REP(i,W) dp[0][i] = 0;
  for(int i=0;i<N;i++) {
    for(int j=0; j<=W; j++) {
      if(j < w[i])
        dp[i+1][j] = dp[i][j];  // iを使わない
      else
        dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
    }
  }

  // REP(i,N){
  //   REP(j,W+1){
  //     printf(" %2d", dp[i][j]);
  //   }
  //   cout<<endl;
  // }
  cout<<dp[N][W]<<endl;

  return 0;
}


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

using namespace std;

typedef pair<int, int> P_ii;
typedef pair<string, int> P_si;
typedef long long int ll;

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

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

const int MOD = 1000000007;

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

    for (int i = 0; i < N - 1; ++i) {
        if (H[i] < H[i + 1]) H[i + 1]--;
        if (H[i] > H[i + 1]) {
            printf("%s\n", "No");
            return 0;
        }
    }
    printf("%s\n", "Yes");
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	ll N,K,Q;
	cin >> N >> K >> Q;

	vll Player(N,0);//何回正解したかを保存
	for(int i=0; i<Q; i++){
		ll A;
		cin >> A;
		A--;
		Player[A]++;
	}

	for(int i=0; i<N; i++){
		string ans="No";
		if(K-(Q-Player[i])>0){
			ans="Yes";
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

// mod. m での a の逆元 a^{-1} を計算する
// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll calc(ll n, ll k, ll mod){
    ll tmp=1;
    // 分子
    for(int i=n;i>=n-k+1;i--){
        tmp *= i % mod;
        tmp %= mod;
    }
    // 分母
    for(int i=k;i>0;i--){
        ll rev = modpow(i,mod-2,mod);
        tmp *= rev % mod;
        tmp %= mod;
    }
    // cout << "tmp: " << tmp << endl;
 
    return tmp;
}


int main(){
    // 前処理
    ll mod = 1e9+7;
    ll N, a, b; cin >> N >> a >> b;

    ll all = modpow(2, N, mod)-1;
    // cout << "all: " << all << endl;
    ll ans = all-calc(N, a, mod)-calc(N, b, mod);
    while (ans<0) ans+=mod;
    cout << ans << endl;

    return 0;
}

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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

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

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

int main(void){
    int N,C; cin >> N >> C;
    int D[C][C]; REP(i,C)REP(j,C) cin >> D[i][j];
    int c[N][N]; REP(i,N)REP(j,N) cin >> c[i][j];

    int n[C][3]; CLR(n);
    REP(i,N)REP(j,N){
        if((i+j)%3 == 0) n[c[i][j]-1][0]++;
        else if((i+j)%3 == 1) n[c[i][j]-1][1]++;
        else if((i+j)%3 == 2) n[c[i][j]-1][2]++;
    }
    int ans = INT_INF;
    REP(i,C)REP(j,C)REP(k,C){
        if(i==j || j==k || k==i) continue;
        int tmp = 0;
        REP(s,C){
            tmp += n[s][0]*D[s][i];
            tmp += n[s][1]*D[s][j];
            tmp += n[s][2]*D[s][k];
        }
        chmin(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

long long mod_inverse(long long x) {
	long  long ret = 1; long long n = mod - 2;
	while (n) {
		if (n & 1)ret = ret * x % mod;
		x = x * x % mod; n >>= 1;
	}
	return ret;
}

ll fact[100100], inv_fact[100100];

ll comb(ll n, ll r) {
    if(n < r || r < 0) return 0;
    if(n == r || r == 0) return 1LL;
    ll ret = fact[n] * inv_fact[n - r] % mod * inv_fact[r] % mod;
    return ret % mod;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll n; cin >> n;
    set<int> s;
    map<int, int> mp;
    ll l;
    rep(i, n + 1) {
        int a; cin >> a;
        if(s.find(a) != s.end()) {
            l = (ll)i - (ll)mp[a];
            break;
        } else {
            s.insert(a);
            mp[a] = i;
        }
    }
    fact[0] = 1LL; inv_fact[0] = 1LL;
    rep1(i, n) {
        fact[i] = fact[i - 1] * i % mod;
        inv_fact[i] = mod_inverse(fact[i]);
    }
    rep1(k, n + 1) {
        ll ans = 0;
        (ans += comb(n - 1, k)) %= mod;
        (ans += comb(n - l, k - 1)) %= mod;
        ((ans += 2LL * (comb(n - 1, k - 1) - comb(n - l, k - 1))) += 3 * mod) %= mod;
        (ans += comb(n - 1, k - 2)) %= mod;
        ans %= mod;
        cout << ans << endl;
    }
	return 0;
}

Measured memory_bytes: 12160
# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)
a.unshift(-1)

b = []

n.downto(1) do |i|
  count = 0
  j = i
  loop do
    count += b[j] || a[j]
    j += i
    break if j > n
  end
  b[i] = count % 2
end
c = []
count = 0
1.upto(n) do |i|
  if b[i].positive?
    c.push i
    count += 1
  end
end
puts count
puts c.join(' ') if count.positive?


Measured memory_bytes: 22916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;


int main(){
    string S;
    cin>>S;
    ll Sz=S.size();
    vector<ll> T(Sz+1, 0),  U(Sz+1, 0);
    ll Sm=0;
    ll Bi=0;
    vector<vector<ll>> TT(3, vector<ll>(0));
    vector<vector<ll>> UU(673, vector<ll>(0));
    TT.at(0).push_back(Sz);
  	UU.at(0).push_back(Sz);
  	ll Ten=1;
    for(ll i=Sz-1;i>=0; i--){
        Sm+=S.at(i)-'0';
        Bi+=(S.at(i)-'0')*Ten;
        Sm%=3;
        Bi%=673;
      	//cout<<i<<"Sm="<<Sm<<"Bi="<<Bi<<endl;
        T.at(i)=Sm;
        U.at(i)=Bi;
        TT.at(Sm).push_back((ll)i);
        UU.at(Bi).push_back((ll)i);
      	Ten*=10;
      	Ten%=673;
    }
    ll Ans=0;
    for(ll i=0; i<=672; i++){
        ll A=UU.at(i).size();
      	if(A>1){
        for(ll j=0; j<A; j++){
            for(ll k=j+1; k<A; k++){
              	//cout<<"!";
                if(T.at(UU.at(i).at(j))==T.at(UU.at(i).at(k))){
                  	//cout<<UU.at(i).at(j)<<" "<<UU.at(i).at(k)<<endl;
                    Ans++;
                }
            }
        }
        }
    }
    cout<<Ans<<endl;
	
}

Measured memory_bytes: 11476
#include<iostream>
#include<stdlib.h>
#include<math.h>
using namespace std ;

int main(){
	
	int a[100]={} , b[100]={} ;
	int n , m ;
	int x , y , min ;
	
	while(1){
		cin >> n >> m ;
		if( n==0 && m==0 ) break;
		
		int sum[2] = {} ;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> a[i] ;
			sum[0] += a[i] ;
		}
		for( int i=0 ; i<m ; i++ ){
			cin >> b[i] ;
			sum[1] += b[i] ;
		}
		
		if( ( sum[0] + sum[1] ) % 2 == 1 ) cout << -1 << endl ;
		else {
			x = -1 ;
			y = -1 ;
			min = 1000 ;
			
			for( int i=0 ; i<n ; i++ ){
				for( int j=0 ; j<m ; j++ ){
					if( sum[0] - a[i] + b[j] == sum[1] - b[j] + a[i] ){
						if( min > a[i] + b[j] ){
							x = a[i] ;
							y = b[j] ;
							min = a[i] + b[j] ;
						}
					}
				}
			}
			
			if( x==-1 && y==-1 ) cout << -1 << endl ;
			else cout << x << ' ' << y <<endl ;
		}
	}
	
return 0;
}

Measured memory_bytes: 1156
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN=2000;
const ll mod=1e9+7;
int a[MAXN+5],cnt1[MAXN+5],cnt2[MAXN+5];
ll n,k,ans;
int main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			if(a[j]<a[i]&&j<i)
				cnt1[i]++;
			if(a[j]<a[i]&&j>i)
				cnt2[i]++;
		}
	for(int i=1;i<=n;i++)
	{
		ans=(ans+cnt2[i]*(k*(k+1)/2%mod))%mod+cnt1[i]*((k*(k-1)/2)%mod)%mod;
		ans%=mod;
	}
	printf("%lld\n",ans%mod);
	return 0;
}



Measured memory_bytes: 256
n = gets.to_i
a = [0] + gets.split.map(&:to_i) + [0]
cost = (1..n + 1).map { |i| (a[i] - a[i - 1]).abs }.inject(:+)
(1..n).each do |i|
  ans = cost
  ans -= (a[i + 1] - a[i]).abs
  ans -= (a[i] - a[i - 1]).abs
  ans += (a[i + 1] - a[i - 1]).abs
  puts ans
end

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

typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;


//===

const ll mod = static_cast<ll>(1e9 + 7);


int main() {
	int N;
	cin >> N;
	vector<tuple<string, int, int>> SS(N);
	for (int i = 0; i < N; ++i) {
		string tmp_s;
		int tmp_i;
		cin >> tmp_s >> tmp_i;
		get<0>(SS[i]) = tmp_s;
		get<1>(SS[i]) = -tmp_i;
		get<2>(SS[i]) = i + 1;
	}
	sort(SS.begin(), SS.end());

	for (int i = 0; i < N; ++i) {
		cout << get<2>(SS[i]) << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
typedef long long ll;
const int N=5005;
const ll inf=1ll<<60;
int n,now=0,head[N],sum[N];
int f[N],dp[1005][N];
using namespace std;

struct node
{
	int t,next;
}adj[N<<1];
void add(int s,int t)
{
	adj[++now]=(node){t,head[s]};
	head[s]=now;
}
inline int read()
{
	char c;int x;
	while (c=getchar(),c<'0' || c>'9');x=c^'0';
	while (c=getchar(),c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x;
}
void write(int x)
{
	if (x==0) return;
	write(x/10);
	putchar((x%10)+'0');
}
void upd(int& x,int y){if (x==-1) x=y;else x=max(x,y);}
void clear(int i){memset(dp[i],0,sizeof(dp[i]));}
void dfs(int s,int fa)
{
	int i,ok=1,j;
	for (i=head[s];i;i=adj[i].next)
	if (adj[i].t!=fa) ok=0,dfs(adj[i].t,s);
	if (ok){f[s]=sum[s];return;}
	int p=0;clear(0);dp[0][0]=1;
	for (i=head[s];i;i=adj[i].next)
	if (adj[i].t!=fa)
	{
		p++;clear(p);
		for (j=0;j<=sum[s];j++)
		{
			if (j>=sum[adj[i].t]) dp[p][j]|=dp[p-1][j-sum[adj[i].t]];
			if (j>=(f[adj[i].t]-sum[adj[i].t])) dp[p][j]|=dp[p-1][j-(f[adj[i].t]-sum[adj[i].t])];
		}
		f[s]+=f[adj[i].t];
	}
	for (j=sum[s];j>=0;j--)
	if (dp[p][j]) break;
	if (j<0){puts("IMPOSSIBLE");exit(0);}
	f[s]+=sum[s]-j;
}
int main()
{
	#ifdef Kay
		freopen ("code.in","r",stdin);
		freopen ("code.out","w",stdout);
	#endif
	scanf ("%d",&n);
	int i,fa;
	for (i=2;i<=n;i++)
	cin>>fa,add(i,fa),add(fa,i);
	for (i=1;i<=n;i++) cin>>sum[i];
	dfs(1,0);
	printf ("POSSIBLE");
	return 0;
}


Measured memory_bytes: 19840
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const MOD = 1e9 + 7;
ll const oo = 8e18;
int const N = 1e5 + 100;
int const M = 1e6 + 100;

int n, m, k;
ll dist, pos, neg, ans, a[N];

int main(){
    scanf("%d%d", &n, &k);
    for(int i = 0;i < n;++i){
        scanf("%lld", &a[i]);
        if(i < k){
            if(a[i] < 0) neg = min(neg, a[i]);
            else pos = max(pos, a[i]);
        }
    }

    ans = 2 * min(abs(neg), pos) + max(abs(neg), pos);

    for(int i = 0, j = k;j < n;++j, ++i){
        if(a[i] < 0) neg = min(0ll, a[i + 1]);
        if(a[j] > 0) pos = a[j];
        ans = min(ans, 2 * min(abs(neg), pos) + max(abs(neg), pos));
    }

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 200005
ll mod=998244353;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){while(a&&b)a>b?a%=b:b%=a;return a+b;}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
int main()
{
    fast;
    string s;
    cin>>s;
    string s1=s.substr(0,4);
    string s2=s.substr(5,2);
    string s3=s.substr(8);
    if(s1>"2019")
    {
        cout<<"TBD\n";
        return 0;
    }
    else if(s1=="2019")
    {
        if(s2>"04")
        {
            cout<<"TBD\n";
            return 0;
        }
        else if(s2=="04")
        {
            if(s3>"30")
            {
                cout<<"TBD\n";
                return 0;
            }
            else
            {
                cout<<"Heisei\n";
            }
        }
        else
        {
            cout<<"Heisei\n";
            return 0;
        }
    }
    else
    {
        cout<<"Heisein";
        return 0;
    }

    return 0;
}


Measured memory_bytes: 256