akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

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

int main() {
	int n; cin >>n;
	vector<ll> v(n+1);
	cinv(n,v);
	v[n] = MOD;
	sort(all(v));
	int index = 0;
	int count = 0;
	for(int i = 1; i <= n; i++){
		if (v[i]!=v[i-1]){
			if((i - index)%2)count++;
			index = i;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
#include<iomanip>
#include<bitset>
#include<math.h>
using namespace std;
 
 
int main(){
 
	int n,k;
	cin >> n >> k;
	vector<int> v(n);
	vector<int> dp(n,1e9);
	dp[0] = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	
	for (int i = 1; i < n; i++)
	{
		for(int j = 1; i-j >= 0 && j < k+1; j++){
			dp[i] = min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
		}
	}
	
	

	cout << dp[n-1] << endl ;

		
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int math, greedy, geometory, dp, graph, other;
	while(cin >> math >> greedy >> geometory >> dp >> graph >> other,
		math + greedy + geometory + dp + graph + other)
	{
		int md = math + dp,
			gg = greedy + graph,
			go = geometory + other;
		int sum = 0;
		for(int i=0; i < 3; i++) {
			if(md >= i && gg >= i && go >= i)
				sum = max(sum, ((md-i)/3 + (gg-i)/3 + (go-i)/3 + i));
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 868
#include <stdio.h>
#include <ctype.h>

int main(){
    int c;
    int cnt[256] = {0};
    while((c=getchar()) != EOF){
       if(isupper(c)){
            c = tolower(c);
        }
        cnt[c]++;
    }
    for(c='a'; c<='z'; c++){
          printf("%c : %d\n", c, cnt[c]);      
    }
    return 0;
}

Measured memory_bytes: 1760
package main

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

func main() {
	n := getInt()
	a := 0.0
	for i := 0; i < n; i++ {
		a += 1 / float64(getInt())
	}

	fmt.Println(1 / a)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


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

using namespace std;

int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++)
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
}
long long ans = 0;
for(auto& p : mp)
{
    int s = p.second;
    ans+=(long long)s*(s-1)/2;
}
cout << ans;
	return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int mod = 1000000007;
using P = pair<int,int>;
int main(){
    int n;
    cin >> n;
    vector<P> d;
    rep(i,n){
        int d1,d2;
        cin >> d1 >> d2;
        d.emplace_back(d1,d2);
    }
    rep(i,n-2){
        if(d.at(i).first == d.at(i).second && d.at(i+1).first == d.at(i+1).second && d.at(i+2).first == d.at(i+2).second){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

using namespace std;

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

using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;

Graph G;

void dfs(int v, int p, int pc, vector<int> &res){
  int color = 1;
  if(color==pc) color++;
  
  for(auto e:G[v]){
    if(e.first==p) continue;
    res[e.second] = color;
    
    dfs(e.first, v, color, res);
    color++;
    if(color==pc) color++;
  }
}



int main(){
  int N;
  cin >> N;
  
  G.assign(N, vector<Edge>());
  
  for(int i=0; i<N-1; i++){
    ll a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b, i);
    G[b].emplace_back(a, i);
  }
  
  int max_color = 0;
  for(int i=0; i<N; i++) chmax(max_color, (int)G[i].size());
  
  vector<int> res(N-1, -1);
  dfs(0,-1, -1, res);
  
  cout << max_color << endl;
  for(auto v: res) cout << v << endl;

  return 0;
}

Measured memory_bytes: 11016
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ill(v) v.begin(), v.end()


int main(){
    ll X, A, B, C, D;
    cin >> X;
    for(int i = -120; i <= 120; i++){
        for(int j = -120; j <= 120; j++){
            A = i*i*i*i*i - j*j*j*j*j;
            if(A == X){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3592
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto s = readln.chomp;

    auto t = s.array;
    t.sort();
    writeln(t == "abc" ? "Yes" : "No");
}


Measured memory_bytes: 256
// failed to generate code

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

#define MAX_M 200001

ll N, M;
ll X[MAX_M], Y[MAX_M], Z[MAX_M];

#define MAX_N 200001

long long par[MAX_N]; // 親
long long rankuf[MAX_N]; // 木の深さ
ll treenum = 0;
// n要素で初期化
void init(long long n) {
	for (long long i = 0; i < n; i++) {
		par[i] = i;
    	rankuf[i] = 0;
	}
	treenum = n;
}
// 木の根を求める
long long find(long long x) {
	if (par[x] == x) {
		return x;
	} else {
		return par[x] = find(par[x]);
	}
}
// xとyの属する集合を併合
void unite(long long x, long long y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (rankuf[x] < rankuf[y]) {
		par[x] = y;
	} else {
		par[y] = x;
		if (rankuf[x] == rankuf[y]) rankuf[x]++;
	}
	treenum--;
}
// xとyが同じ集合に属するか否か
bool same(long long x, long long y) {
	return find(x) == find(y);
}

int main(){	
	cin >> N;
	cin >> M;
	init(N);
	for (int i = 0; i < M; i++) {
		cin >> X[i];
		cin >> Y[i];
		cin >> Z[i];
		unite(--X[i], --Y[i]);
	}
	// map<ll, ll> m;
	// // for (int i=0; i<N; i++) m[i] = 0;
	// // ll res = 0;
	// for (int i = 0; i < N; i++) {
	// 	if (m[par[i]] == 0) {
	// 		m[par[i]]++;
	// 		// res++;
	// 	}
	// 	// cout << par[i] << endl;
	// }
	cout << treenum << endl;
}


Measured memory_bytes: 6400
#include<iostream>
#include<set>


using namespace std;


int main(){

    int a, b, k;
    cin >> a >> b >> k;

    set<int> s;

    for(int i = a; i < min(b, a + k); i++){
         s.insert(i);

    }
    for(int i = max(a, b-k+1); i <= b; i++){
         s.insert(i);
     }


    set<int>::iterator it;

    for(it = s.begin(); it != s.end(); it++){
         cout << *it << '\n';
     }



    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int K;
int Q;
int A[100010];
int num[100010];

signed main(){
	cin>>N>>K>>Q;
	REP(i,Q){
		cin>>A[i];
		num[A[i]-1]++;
	}
	REP(i,N){
		if(K-(Q-num[i])<=0){
			cout<<"No"<<endl;
		}
		else{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 2176
#include <stdio.h>

int main(void)
{
	int x, y;
	int buf;
	int step;
	
	while (1){
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0){
			break;
		}
		
		if (!(x >= y)){
			buf = y;
			y = x;
			x = buf;
		}
		
		step = 0;
		while (y != 0){
			x = x % y;
			buf = y;
			y = x;
			x = buf;
			step++;
		}
		
		printf("%d %d\n", x, step);
	}
	
	return (0);
}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c;
  d = b * 10 + c ;
  if(d % 4 == 0){
    cout << "YES\n";
  }
  else cout << "NO\n";
}
  
 

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main()
{
   long long a,b;
   cin>>a;
   cin>>b;
   bool c = (a+b)%2 == 0;
   if(c)
    cout<<(a+b)/2<<endl;
   else
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string ans="No";
  string S; cin>>S;
  if(S.size()>=4&&S.substr(0,4)=="YAKI") ans="Yes";
  cout<<ans<<endl;
  }


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

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 1e6 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 1e5 + 17;

int n;

bool read() {
    if (scanf("%d", &n) != 1)
        return false;

    return true;
}

void solve() {
    int ans = 0;

    for (int i = 0; i < n; ++i) {
        int x;
        scanf("%d", &x);
        ans ^= x & 1;
    }

    if (ans)
        printf("NO\n");
    else
        printf("YES\n");
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer


object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val a = for (_ <- 0 until n) yield sc.nextLong()
    (n, a)
  }

  def divisor(n: Long): IndexedSeq[Long] = {
    val buf = ArrayBuffer.empty[Long]
    for (i <- 1 to Math.sqrt(n).toInt) {
      if (n % i == 0) {
        buf.append(i)
        if (i * i != n) {
          buf.append(n / i)
        }
      }
    }
    buf.toIndexedSeq
  }

  def solve(n: Int, a: IndexedSeq[Long]): Long = {
    val cand = IndexedSeq.concat(divisor(a(0)), divisor(a(1))).distinct.sorted

    def satysfies(x: Long): Boolean = {
      //a.count(ae => ae % x == 0) >= a.length - 1
      a.count(_ % x == 0) >= a.length - 1
    }

    cand.filter(satysfies).max
  }

  def gcd(x: Long, y: Long): Long = {
    assert(x >= 0 && y >= 0)
    val min = Math.min(x, y)
    val max = Math.max(x, y)
    if (min == 0) max
    else gcd(max % min, min)
  }

  def solve2(n: Int, a: IndexedSeq[Long]): Long = {
    val cumGCDLeft = a.scanLeft(0L)(gcd)
    val cumGCDRight = a.reverse.scanLeft(0L)(gcd).reverse

    // [0, end)
    def subCumGCDLeft(end: Int) = cumGCDLeft(end)

    // [start, n)
    def subCumGCDRight(start: Int) = cumGCDRight(start)

    // [0, i) + [i+1, n)
    (0 until n).map(i => gcd(subCumGCDLeft(i), subCumGCDRight(i + 1))).max
  }

  def main(args: Array[String]): Unit = {
    val (n, a) = read()
    println(solve2(n, a))
  }
}

Measured memory_bytes: 67944
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;

#define INF 999999999

int main(){
	int n, s[100], k;
	double l, g, sum;
	double ans;
	while(1){
		cin >> n;
		if(!n) break;
		g = -1;
		l = 1001;
		sum = 0;
		for(k=0;k<n;k++){
			cin >> s[k];
			sum += s[k];
			if(g < s[k]) g = s[k];
			if(l > s[k]) l = s[k];
			//cout << g << " " << l << " " << sum << endl;
		}
		ans = (sum - l - g)/((double)n-2);
		cout << (int)ans << endl;
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  if (n == 3) {
    cout << 2 << " " << 5 << " " << 63 << endl;
  } else if (n == 4) {
    cout << 2 << " " << 5 << " " << 20 <<" " << 63 << endl;
  } else if (n == 6) {
    cout << 2 << " " << 3 << " " << 5 << " " << 10 << " " << 15 << " " << 55 << endl;  
  } else if (n == 19999) {
    for(int i = 1; i <= 14985; i++) cout << 2*i << " ";
    for(int i = 1; i <= 5000; i++) cout << 3 + 6*(i-1) << " ";
    for(int i = 1; i <= 7; i++) cout << 5 + 30*(i-1) << " ";
    for(int i = 1; i <= 7; i++) cout << 25 + 30*(i-1) << " ";
    cout << endl;
  } else {
    int m = 0;
    for(int a = 15000; a >= 3; a -= 3) {
      int b = n - a;
      if((b % 2) == 0 && b >= 1 && 6*(b-1)+3 <= 30000) {
        for(int i = 1; i <= a; i++) cout << 2*i << " ";
        for(int i = 1; i <= b; i++) cout << 3 + 6*(i-1) << " ";
        cout << endl;
        break;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;
ll gcd(ll x,ll y)
{
    if(y%x==0) return x;
    else
        return gcd(y%x,x);
}
ll lcm(ll x, ll y)
{
    if(x>y) swap(x,y);
    if(y%x==0) return y;
    ll temp = gcd(x,y);
    return (y/temp)*x;
}
int main()
{
    ll n,x,ans=1;cin>>n;
    while(n--)
    {
        cin>>x;
        ans = lcm(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}


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

// long long 用の pow (MAX ll 9,223,372,036,854,775,807 -> 19桁)
ll myLongLongPow(ll base, ll times) {
    ll acc = 1;
    rep(i, times) acc *= base;
    return acc;
}

// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    rep(i, N) cin >> p.at(i);

    sort(p.begin(), p.end());

    int ans = 0;
    rep(i, K) {
        ans += p.at(i);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3588
import java.util.Scanner;


public class Main {

	static int[][] table;
	static long[][] dp;
	static int N;
	static int W;

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

		N = sc.nextInt();
		W = sc.nextInt();
		long max = 0;

		table = new int[N][2];
		for (int i = 0; i < N; i++) {
			table[i][0] =sc.nextInt();
			table[i][1] =sc.nextInt();
		}

		dp = new long[N + 1][W + 1];

		for (int i = 0; i < N; i++) {
			for (int j = 0; j <= W; j++) {
				if (j - table[i][0] >= 0) {
					dp[i+1][j] = Math.max(dp[i+1][j], dp[i][j - table[i][0]] + table[i][1]);
				}
				dp[i+1][j] = Math.max(dp[i+1][j], dp[i][j]);
			}
		}

		System.out.println(dp[N][W]);

	}

}


Measured memory_bytes: 140312
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define range(i, a, b, s) for (int i = (a); i < (b); i += (s))
#define down(i, a, b, s) for (int i = (a); (b) < i; i -= (s))

struct _solver {
  long long ls, rs, bs;
  priority_queue<int, vector<int>, less<int>> lhs;
  priority_queue<int, vector<int>, greater<int>> rhs;

  void clear() {
    ls = rs = bs = 0;
    while (!lhs.empty()) lhs.pop();
    while (!rhs.empty()) rhs.pop();
  }

  void push_l(int x) {
    lhs.push(x);
    ls += x;
  }

  void push_r(int x) {
    rhs.push(x);
    rs += x;
  }

  long long pop_l() {
    long long k = lhs.top();
    ls -= k;
    lhs.pop();
    return k;
  }

  long long pop_r() {
    long long k = rhs.top();
    rs -= k;
    rhs.pop();
    return k;
  }

  void update(int a, int b) {
    bs += b;
    push_l(a);
    if (lhs.size() > rhs.size() + 1) {
      push_r(pop_l());
    }
    while (rhs.size() > 0 && lhs.top() > rhs.top()) {
      long long ll = pop_l();
      long long rr = pop_r();
      push_l(rr);
      push_r(ll);
    }
  }

  pair<long long, long long> query() {
    long long k = lhs.top();
    long long l = k * (long long)lhs.size() - ls;
    long long r = rs - k * (long long)rhs.size();
    return mp(k, l + r + bs);
  }
} solver;

int q, a, b, c;

int main(int argc, char const *argv[]) {
  // freopen("F.txt", "r", stdin);

  while (cin >> q) {
    solver.clear();
    range(_, 0, q, 1) {
      cin >> c;
      if (c == 1) {
        cin >> a >> b;
        solver.update(a, b);
      } else {
        auto ans = solver.query();
        cout << ans.fi << " " << ans.se << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3452
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
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();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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 a,b,c; cin >> a >> b >> c;
    if(a==b || b==c || c==a){
        if(a==b && b==c) cout << 1 << endl;
        else cout << 2 << endl;
    }
    else cout << 3 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	long n = sca.nextLong();
	long a = sca.nextLong();  // blue
	long b = sca.nextLong();  // red
	long blue_times = n / (a+b);
	long blue_amari = n % (a+b);
	long ans = a * blue_times;


	if(blue_amari > a) {
		ans += a;
	}
	else {
		ans += blue_amari;
	}

	System.out.println(ans);


	// 後始末
	sca.close();
	}
}

Measured memory_bytes: 25300
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

struct Info
{
    std::string name;
    int point;
    int num;

    Info(std::string inputted_name, int inputted_point,int inputted_num)
    {
        name = inputted_name;
        point = inputted_point;
        num = inputted_num;
    }
    
    
};

bool asc( const Info& left, const Info& right ) {
    return left.name == right.name ? left.point > right.point : left.name < right.name;
}

int main(void){
   int N;
   cin >> N;
   vector<Info> info;
   
   int p;
   string s;
   for(int i=0;i<N;i++){
       cin >> s >> p;
       info.push_back(Info(s, p, i+1));
   }
   
   sort(info.begin(),info.end(),asc);
   
   for(auto itr : info){
       cout << itr.num <<endl;
   }
}


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

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;
	int m = max({a,b,c});
	if((a + b + c) % 2 != m % 2)m++;
	cout << (m * 3 - a - b - c)/2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
char n[4];
scanf("%s", n); 
for(int i=0;i<strlen(n);i++){
    if(n[i]=='1'){
        n[i]='9';
    }else{
        n[i]='1';
    }
}
printf("%s\n", n); 
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int h[n];
	for(int i=0;i<n;i++)
	cin>>h[i];
    
    int height[n];
    height[n-1]=0;
    for(int i=n-2;i>=0;i--)
    {
    int j=1;
    height[i]=INT_MAX;
    while(j<=k&&i+j<n)
    {
    height[i]=min(height[i],abs(h[i+j]-h[i])+height[i+j]);    
    j++;
    }
    }
    cout<<height[0];
	return 0;
}

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

int main() {
    int r, c, i, j, o = 0;
    cin >> r >> c;
    int a[r+1][c+1];

    for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
            cin >> a[i][j];
        }
    }

    for (i = 0; i < r; i++) {
        for (j = 0; j <= c; j++) {
            if (j != c) {
                cout << a[i][j] <<  " ";
                o += a[i][j];
            } else {
                a[i][j] = 0;
                a[i][j] = o;
                cout << a[i][j] << endl;
                o = 0;
            }
        }
    }

    for (j = 0; j <= c; j++) {
        for (i = 0; i <= r; i++) {
            if (i != r) {
                o += a[i][j];
            } else {
                cout << o;
                o = 0;
            }
        }
        if (j != c) {
            cout << " ";
        } else {
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a,b;
	cin>>a>>b;
	long ans=b;
	for(int i=1;i<a;i++)ans*=b-1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int num,p[50],cnt=0,f=0;
	scanf("%d",&num);
	for(int i=0;i<num;i++)
	{
		scanf("%d",&p[i]);
		if(p[i]!=(i+1)) cnt++;
		if(cnt>=3)
		{
			f=1;
			break;
		}
	}
	if( f==1 ) printf("NO\n");
	else printf("YES\n");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;

char c;

int main() {
    ios_base::sync_with_stdio(0);
    cin >> c;

    if('A' <= c && c <= 'Z') {
        cout << 'A' << endl;
    }
    else {
        cout << 'a' << 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 sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;

int H,W,K;
int xs,xg,ys,yg;
vector<vector<int>> rake;
vector<vector<int>> checked;

void dfs(int x,int y,int bx,int by){
    if(x>=H || x<0 || y>=W || y<0)return;
    if(rake.at(x).at(y))return;
    if(checked.at(x).at(y))return;
    checked.at(x).at(y)=checked.at(bx).at(by)+1;
    dfs(x+1,y,x,y);
    dfs(x-1,y,x,y);
    dfs(x,y+1,x,y);
    dfs(x,y-1,x,y);
    return;
}

int main() {
    
    cin>>H>>W>>K;
    
    cin>>xs>>ys>>xg>>yg;
    --xs;--xg;--ys;--yg;
    rake.resize(H,vector<int> (W));
    checked.resize(H,vector<int> (W,0));
    rep(i,H)rep(j,W){
        char c;
        cin>>c;
        if(c=='@'){rake.at(i).at(j)=1;}
    }
    vector<vector<int>> reached(H,vector<int> (W));
    queue<pair<P,pair<ll,P>>> q;
    q.push({{xs,ys},{0,{xs,ys}}});

    dfs(xs,ys,xs,ys);
    if(checked.at(xg).at(yg)==0){
        cout<<-1<<endl;return 0;
    }
    
    while(!q.empty()){
        pair<P,pair<ll,P>> now;
        now=q.front();q.pop();
        if(xg==now.first.first && yg==now.first.second){
            cout<<now.second.first<<endl;
            return 0;
        }
        if(reached.at(now.first.first).at(now.first.second)==1)continue;
        reached.at(now.first.first).at(now.first.second)=1;
        int x=now.first.first,y=now.first.second;
        int bx=now.second.second.first,by=now.second.second.second;
        if(abs(x-bx)==K || x==bx || x==0 || x==H-1){
        for(int i=1;i<=K;i++){
            if(x+i>=H)break;
            if(rake.at(x+i).at(y))break;
            if(reached.at(x+i).at(y))continue;
            q.push({{x+i,y},{now.second.first+1,{x,y}}});
        }

        for(int i=1;i<=K;i++){
            if(x-i<0)break;
            if(rake.at(x-i).at(y))break;
            if(reached.at(x-i).at(y))continue;
            q.push({{x-i,y},{now.second.first+1,{x,y}}});
        }
        }
        if(abs(y-by)==K || y==by || y==0 || y==W-1){
        for(int i=1;i<=K;i++){
            if(y+i>=W)break;
            if(rake.at(x).at(y+i))break;
            if(reached.at(x).at(y+i))continue;
            q.push({{x,y+i},{now.second.first+1,{x,y}}});
        }
        for(int i=1;i<=K;i++){
            if(y-i<0)break;
            if(rake.at(x).at(y-i))break;
            if(reached.at(x).at(y-i))continue;
            q.push({{x,y-i},{now.second.first+1,{x,y}}});
        }
        }
    }
}

Measured memory_bytes: 176872
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>

typedef long long ll;
using namespace std;

int gcd(int a,int b)
{
	return b==0?a:(gcd(b,a%b));
}
ll mapx[201][201];
int main()
{
    int n;
    cin>>n;
    ll sum=0;
    for(int k=1;k<=n;k++)
    {
        for(int j=1;j<=n;j++)
        {
            mapx[k][j]=gcd(k,j);
        }
    }
    for(int k=1;k<=n;k++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int i=1;i<=n;i++)
            {
                int ans=mapx[k][j];
                sum+=mapx[ans][i];
            }
        }
    }
    cout<<sum;
    return 0;
}



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

int main(){
  int H,W;
  cin >> H >> W;
  
  vector<string> picture(H);
  
  int i;
  for(i = 0 ; i < H ; i++){
    cin >> picture.at(i);
    picture.at(i).push_back('#');
  }
  
  for(i = 0 ; i < W + 2 ; i++)	cout << '#';
  cout << endl;
  for(i = 0 ; i < H ; i++)		cout << '#' << picture.at(i) << endl;
  for(i = 0 ; i < W + 2 ; i++)	cout << '#';
  cout << endl;
}

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

int main(){
	int cnt=0,tmp,n;
	cin >> n;
	map<int,int> a;
	for(int i=0;i<n;i++){
		cin >> tmp;
		a[tmp]++;
	}
	for(auto b:a)
		cnt+=b.second%2;
	cout << cnt << endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>

int main() {

	int n[10];

	for (int i = 0; i < 10; ++i) {

		std::cin >> n[i];

	}

	std::sort(n, n + 10);

		for (int i = 9; i > 6; --i) {
			std::cout << n[i] << std::endl;
		}

}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
int a=0,b=-1,c=0,d=0;
while (true) {
  std::cin >> n;
  if(n==0)break;
  std::vector<string> v;
rep(i,n){
  std::cin >> x>>y>>z;
if(x==100||y==100||z==100) v.pb("A");
else if((x+y)/2>=90)v.pb("A");
else if((x+y+z)/3>=80)v.pb("A");
else if((x+y+z)/3>=70)v.pb("B");
else if((x+y+z)/3>=50&&(x>=80||y>=80))v.pb("B");
else v.pb("C");
  }
rep(i,n)std::cout << v[i] << '\n';
}
  }



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int i=0,j,c=0,k;
    string s,t,s1;
    cin >> s >> t;
    c=s.size();
    for(i=0;i<c;i++)
    {
        s1=s[c-1];
        s=s.erase(c-1,1);
        s=s1+s;
        if(s==t)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;

}


Measured memory_bytes: 3632
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

mod = 1000000007
N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    a = 1
    b = 1
    if x <= 2:
        return a
    else:
        for _ in range(x-2):
            tmp = a
            a = b
            b = tmp + b
        return b

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1) % mod
    res %= mod
    prev_a = cur_a
    continue

print(res)


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

const int MAX = 5100000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

int main() {
    ll X, Y; cin >> X >> Y;
    ll div_num = 10000000007;

    ll Na=0;
    ll Nb=0;
    ll sum = 1;
    ll sum_na = 1;
    ll sum_nb = 1;
    ll tmp0 = (2*Y %div_num) -(X % div_num);
    ll tmp1 = (2*X %div_num) -(Y % div_num);

    COMinit();

    if(tmp0 < 0 || tmp1 < 0){
        cout << 0 << endl;
        return 0;
    }

    if(tmp0%3==0 && tmp1%3==0){
        Na = tmp0 / 3;
        Nb = tmp1 / 3;

        ll answer = COM(Na+Nb, Na);
        cout << answer << endl;
    }
    else{
        cout << 0 << endl;
        return 0;
    }

}

Measured memory_bytes: 119808
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    string w[n], ans = "Yes";
    for (int i = 0; i < n; i++) cin >> w[i];
    for (int i = 1; i < n; i++) {
        if (w[i][0] != w[i - 1][w[i - 1].size() - 1]) {
            ans = "No";
            break;
        }
        int cnt = 0;
        for (int j = 0; j < i; j++) {
            if (w[i] == w[j]) {
                cnt++;
                break;
            }
        }
        if (cnt > 0) {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;




int main() {
    int a, b;
    cin >> a >> b;
    int ans,n;
    ans = 0;
    n = 0;
    while (ans<b) {
        ans = (n - 1) * (a - 1) + a;
        n++;
    }
    cout << n-1 << endl;

}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BAcrostic {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string s;
	    int w;
	    in >> s >> w;

	    string res = "";
	    for(int i=0; i<s.length(); i++){
            if(i%w == 0) res += s[i];
	    }

	    out << res << endl;
	}
};


int main() {
	BAcrostic solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);i
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin); i != (end); i += 1 - 2 * ((begin) > (end)))
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int X10 = 1024, X11 = 2048, X12 = 4096, X13 = 8196, X14 = 16392, X15 = 32786, X16 = 65536, X17 = 131072, X18 = 262144, X19 = 524288, X20 = 1048576;

const int MOD = (int)(1e9+7);
template<typename T>
T read(){T x;cin >>x;return x;}

int A[3];
void _(){
    cin >> A[0] >> A[1] >> A[2];
    sort(A, A+3);
    cout << A[0] + A[1] + 10*A[2];

}

int main() {
#ifdef Debug
    freopen("/home/hiroo/Desktop/competitive-programming/IO/Input.txt", "r", stdin);
    freopen("/home/hiroo/Desktop/competitive-programming/IO/Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}




Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
BOXES = [0] * n

i = n // 2
BOXES[i:] = A[i:]

j = i
for _ in range(i):
    k = j - 1
    count = 0
    while True:
        count += BOXES[k]
        k += j
        if k >= n:
            break
    if count % 2 != A[j - 1]:
        BOXES[j - 1] = 1
    j -= 1

m = sum(BOXES)
print(m)
for i in range(n):
    if BOXES[i] == 1:
        b = i + 1
        print(b)


Measured memory_bytes: 8784
#include <iostream>
#include <cstdio>                                               //scanf,printf
#include <algorithm>                                            //max,min
#include <string>                                               //string
#include <cstring>                                              //strlen,strcat
#include <cctype>                                               //isalpha,tolower
#include <cmath>                                                //sqrt,sin
using namespace std;

struct Dice{
    int ue;
    int sita;
    int mae;
    int usiro;
    int migi;
    int hidari;
};

int main(){
    Dice dice;
    cin>>dice.ue>>dice.usiro>>dice.migi>>dice.hidari>>dice.mae>>dice.sita;
    string ch;
    cin>>ch;
    for(int i=0; i<ch.size(); i++){
        int a=dice.ue,b=dice.sita, c=dice.mae,d=dice.usiro,e=dice.migi,f=dice.hidari;
        if(ch[i]=='S'){
            dice.ue=c;
            dice.usiro=a;
            dice.sita=d;
            dice.mae=b;
        }else if(ch[i]=='N'){
            dice.ue=d;
            dice.usiro=b;
            dice.sita=c;
            dice.mae=a;
        }else if(ch[i]=='E'){
            dice.ue=f;
            dice.sita=e;
            dice.migi=a;
            dice.hidari=b;
        }else{
            dice.ue=e;
            dice.sita=f;
            dice.migi=b;
            dice.hidari=a;
        }
    }
    cout<<dice.ue<<endl;
}



Measured memory_bytes: 3228
import java.util.*;
public class Main { 
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			int n = stdIn.nextInt();
			int m = stdIn.nextInt();
			int q = stdIn.nextInt();
			if(n == 0 && m == 0 && q == 0) break;
			String[] S = new String[q];
			String[] B = new String[q];
			for(int i = 0; i < q; i++) {
				S[i] = stdIn.next();
				B[i] = stdIn.next();
			}
			boolean[][] SX = new boolean[q][n];
			boolean[][] BX = new boolean[q][m];
			for(int i = 0; i < q; i++) {
				for(int j = 0; j < n; j++) {
					SX[i][j] = (S[i].charAt(j) == '1')?true:false;
				}
				for(int j = 0; j < m; j++) {
					BX[i][j] = (B[i].charAt(j) == '1')?true:false;
				}
				if(i != 0) {
					for(int j = 0; j < n; j++) {
						SX[i][j] = (S[i].charAt(j) == '1')?!SX[i-1][j]:SX[i-1][j];
					}
					for(int j = 0; j < m; j++) {
						BX[i][j] = (B[i].charAt(j) == '1')?true:false;
					}
				}
			}
			boolean[][] list = new boolean[n][m];
			for(int i = 0; i < q; i++) {
				for (int j = 0; j < n; j++) {
					if (SX[i][j]) {
						for (int k = 0; k < m; k++) {
							if (!BX[i][k]) {
								list[j][k] = true;
							}
						}
					}
					if (!SX[i][j]) {
						for (int k = 0; k < m; k++) {
							if (BX[i][k]) {
								list[j][k] = true;
							}
						}
					}
				}
				
			}
			if(n == 1) {
				for(int i = 0; i < m; i++) {
					System.out.print(0);
				}
				System.out.println();
				continue;
			}
			int[] ans = new int[m];
			for(int i = 0; i < m; i++) {
				ans[i] = -1;
				int count = 0;
				int id = 0;
				for(int j = 0; j < n; j++) {
					if(!list[j][i]) {
						id = j;
						count++;
					}
					if(count >= 2) break;
				}
				if(count == 1) {
					ans[i] = id+1;
				}
			}
			for(int i = 0; i < ans.length; i++) {
				if(ans[i] == -1) {
					System.out.print("?");
				}
				else if(ans[i] <= 10) {
					char a = '0';
					a += ans[i]-1;
					System.out.print(a);
				}
				else {
					char a = 'A';
					a += (ans[i] - 11);
					System.out.print(a);
				}
			}
			System.out.println();
		}
	}
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n;
int d[1111];
bool used[11111];


int main(){
	cin.sync_with_stdio(false);
	cin>>n;
	rep(i,n)cin>>d[i];
	rep(i,n)repl(j,i,n){
		if(j-i>3)continue;
		int num=0;
		repl(k,i,j+1)num*=10,num+=d[k];
		used[num]=true;
	}
	rep(i,11111){
		if(!used[i]){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)

#define ll long long

int main() {

	ios::sync_with_stdio(false);
    cin.tie(nullptr);

    // freopen("input.in", "r", stdin);


    string s,t;
    cin>>s;
    cin>>t;

    int i,j;
    int max1 = -1;
    for (i=0;i<s.size()-t.size()+1;i++) {
        int r = 0;
        for (j=0;j<t.size();j++)
        if (s[i+j] == t[j]) {
            r++;
        }

        if (r> max1)
            max1 = r;
    }

    cout<<t.size() - max1<<"\n";

    return 0;
}

Measured memory_bytes: 3652
#include <utility>
#include <vector>
#include <iostream>
#include <cstdlib>
#include<bits/stdc++.h>
#include <limits>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string ans = "";
    for(int i = sy; i < ty; i++){
        ans += "U";
    }
    for(int i = sx; i < tx; i++){
        ans +="R";
    }
    for(int i = ty; i > sy; i--){
        ans +="D";
    }
    for(int i = tx; i > sx; i--){
        ans += "L";
    }
    ans += "L";
    for(int i = sy; i <= ty; i++){
        ans +="U";
    }
    ans += "R";
    for(int i = sx; i < tx; i++){
        ans +="R";
    }
    ans += "DR";
    for(int i = ty; i >=sy; i--){
        ans+="D";
    }
    for(int i = tx; i >= sx; i--){
        ans+="L";
    }
    ans += "U";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
const long long MOD = 1e9 + 7, INF = 1e18;
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;}



signed main(){
	int N;
	cin >> N;
	string s;
	cout << 0 << endl;
	flush(cout);
	cin >> s;
	if(s == "Vacant")return 0;
	int l = 0, r = N;
	while(r - l > 1){
		int c = (l + r) / 2;
		string t;
		cout << c << endl;
		flush(cout);
		cin >> t;
		if(t == "Vacant")return 0;
		if((s != t) ^ (c % 2)) r = c;
		else l = c;
	}
}


Measured memory_bytes: 852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	 public static void main(String[] args) throws IOException {
	        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	        int n = Integer.parseInt(br.readLine());
        
	        String[] su=br.readLine().split(" ");
	        	        
		    StringBuilder outArray = new StringBuilder();
		    
		    for(int i=n-1;i>=0;i--){
		    	outArray.append(su[i] + " ");
		    }
		    int p=outArray.length();
		    outArray.deleteCharAt(p-1);
		    System.out.println(outArray);
	}
}

Measured memory_bytes: 16920
#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>;

int main() {
  int r;
  cin >> r;
  
  cout << fixed << setprecision(10) << 3.141592 * r * 2 << endl;
}

Measured memory_bytes: 3784
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 100000000000;
const long long MOD = 1000000007;

long long f(long long N){
  string s = to_string(N);
  long long ret = 0;
  for (int i = 0; i < s.length();i++){
    ret += s[i] - '0';
  }
  return ret;
}

int main()
{
  long long N;
  cin >> N;
  if(N%f(N)==0)cout << "Yes" << endl;
  else
    cout << "No" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

int main()
{
    IOS; 
    char c;
    cin>>c;
    cout<<char(int(c)+1)<<endl;
}  

Measured memory_bytes: 256
from collections import Counter
n, t = map(int, input().split())
a = list(map(int, input().split()))
cnt = Counter(a)
cnt_tmp = Counter()
#i番目以下の最小値
min_a = [a[0] for _ in range(n)]
for i in range(n-1):
    min_a[i+1] = min(a[i+1], min_a[i])

res = 0
for i in range(1, n):
    res = max(a[i] - min_a[i-1], res)

ans = 0
for i in range(n):
    cnt_tmp[a[i]] += 1
    x = a[i] + res
    cnt_a = cnt_tmp[a[i]]
    cnt_x = cnt[x] - cnt_tmp[x]
    ans += min(cnt_a, cnt_x)

print(ans)


Measured memory_bytes: 27164