akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long

#define inf 1000000007LL
#define mod 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
#define rfor(i, s, t) for(int i = (t) - 1; i >= (s); i--)

int pow(int x, int n) {
  int r = 1;
  while(n) {
    if(n & 1) {
      r = r * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return r;
}

int inv(int x) {
  return pow(x, mod - 2);
}

int c[114514];
int d[114514];

int ans[114514];

signed main() {
  int n;
  cin >> n;
  rep(i, n) {
    c[i] = 0;
  }
  rep(i, n + 1) {
    int w;
    cin >> w;
    w--;
    d[i] = w;
    c[w]++;
  }
  int k;
  rep(i, n) {
    if(c[i] == 2) {
      k = i;
      break;
    }
  }
  vector<int> v;
  rep(i, n + 1) {
    if(d[i] == k) {
      v.push_back(i);
    }
  }
  rep1(i, n + 1) {
    ans[i] = 0;
  }
  int ww = v[1] - v[0] - 1;
  int all = 1;
  int ot = 1;
  ans[1] = 1;
  ans[2] = 1;
  rep1(i, n - 1) {
    all = all * (n - 1 - i + 1) % mod * inv(i) % mod;
    if(i <= n - 1 - ww) {
      ot = ot * (n - 1 - ww - i + 1) % mod * inv(i) % mod;
      ans[i] += all;
      ans[i + 1] += all * 2 - ot + mod;
      ans[i + 2] += all;
    }
    else {
      ans[i] += all;
      ans[i + 1] += all * 2;
      ans[i + 2] += all;
    }
  }
  rep1(i, n + 1) {
    cout << ans[i] % mod << endl;
  }
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
char str[101];
int main()
{
	long long n;
	int i,k=0;
	scanf("%s",&str);
	scanf("%lld",&n);
	for(i=0;i<strlen(str);i++)
	{
		if(str[i]=='1')
			k++;
		else
			break;
	}
	if(k>=n)
		printf("1");
	else
		printf("%c",str[k]);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int count = 0;
	char s[3];

	scanf("%c", &s[0]);
	scanf("%c", &s[1]);
	scanf("%c", &s[2]);

	if(s[0] == 'R') {
		count++;
		if(s[1] == 'R') {
			count++;
			if(s[2] == 'R') {
				count++;
			}
		}
	}
	else if(s[1] == 'R') {
		count++;
		if(s[2] == 'R') {
			count++;
		}
	}
	else if(s[2] == 'R') {
		count++;
	}

	printf("%d", count);
}

Measured memory_bytes: 1660
while 1:
    n = int(input())
    if n == 0:break
    k = [x for x in map(int,input().split()) if x >0]
    k2 = [x for x in k if x > 1]
    if len(k2) > 0:
        print(len(k)+1)
    else:
        print('NA')

Measured memory_bytes: 8700
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    // 考察:
    // RL の部分は交互に入れ替わり続けて、
    // RL 以外の部分は最終的に RL の左右どちらかに合流する
    // どっちに合流するか RL との距離の偶奇と方向で決まる?
    // RL の左側にある R は近い方から B, A, B, A.. と塗る
    // RL の右側にある L は近い方から A, B, A, B.. と塗る
    // A なら RL の左側 +1
    // B なら RL の右側 +1

    let S = rl().chars().collect::<Vec<_>>();
    let N = S.len();

    let mut i = 0;
    let mut X = vec![0; N];
    while i + 1 < N {
        if S[i] == 'R' && S[i + 1] == 'L' {
            X[i] += 1;
            X[i + 1] += 1;

            let mut k = 1;
            for j in (0..i).rev() {
                if S[j] != 'R' {
                    break;
                }
                X[i + k] += 1;
                k ^= 1;
            }

            let mut k = 0;
            for j in (i + 2)..N {
                if S[j] != 'L' {
                    break;
                }
                X[i + k] += 1;
                k ^= 1;
            }

            i += 2;
            continue;
        }

        i += 1;
    }

    println!(
        "{}",
        X.into_iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    )
}


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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 gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}



int main(void){
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> to[n+100];
  REP(i, m){
    int a, b;
    cin >> a >> b;
    a--;b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  queue<int> q;
  vector<int> dist(n, INF);
  dist[0] = 0;
  vector<int> pre(n, -1);
  q.push(0);
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    for (int v : to[now]){
      if (dist[v] != INF) continue;
      dist[v] = dist[now] + 1;
      pre[v] = now;
      q.push(v);
    }
  }
  cout << "Yes" << endl;
  FOR(i, 1, n) cout << pre[i] + 1 << endl;
  return 0;
}



Measured memory_bytes: 10592
//It doesn't matter how slow you go, Unless you don't stop.
#include<iostream>
#include<algorithm>
#include<bitset>
 
#include<cmath>
#include<cstring>
#include<climits>
 
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
 
#include<fstream>
#include<chrono>
using namespace std;
 
typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;
typedef map<LL,LL> mp64;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(long long i=s;i<=e;i++)
#define brep(i,s,e) for(long long i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

void solve()
{
     int n;cin>>n;
     vector<LL> a(n);
     vector<LL> b(n);
     vector<LL> add(n);
     vector<LL> sub(n);
     for(int i=0;i<n;i++){
         cin>>a[i]>>b[i];
         add[i] = {a[i]+b[i]};
         sub[i] = {a[i]-b[i]};
     }
     sort(all(add));
     sort(all(sub));
     LL mx_add = add[n-1];
     LL mn_add = add[0];
     LL mx_sub = sub[n-1];
     LL mn_sub = sub[0];
     cout<<max(mx_add-mn_add,mx_sub-mn_sub);

     
     
}
 
int main()
{
    DANGER;
    ofstream out("output.txt");
 
    auto start = chrono::high_resolution_clock::now();
    
    LL t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        solve();
    }
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

Measured memory_bytes: 9524
import java.util.*;

class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long N = sc.nextLong();
        for (int i = (int)Math.sqrt(N); i > 0; i--) {
            if (N % i == 0) {
                long j = N / i;
                System.out.println(i + j - 2);
                break;
            }
        }
    }
}


Measured memory_bytes: 21844
fun main() {
    val iLine = readLine()!!.split(" ").map(String::toLong)
    val a = iLine[0]
    val b = iLine[1]
    val c = iLine[2]
    val k = iLine[3]


    val result = if(a >= k){
        k
    }else if(a + b >= k){
        a
    }else if(a + b + c >= k){
        2 * a + b - k
    }else if(a == 0L && c == 0L){
        0
    }else if(a == 0L && c <= k){
        - c
    }else{
        - k
    }

    println(result)
}

Measured memory_bytes: 36420
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC
{
    public static void Main()
    {
        string S = Console.ReadLine();
        string mae, ato;
        mae = S[0] + "" + S[1];
        ato = S[2] + "" + S[3];

        int nmae = int.Parse(mae);
        int nato = int.Parse(ato);

        if (month(nmae) && month(nato))
        {
            Console.WriteLine("AMBIGUOUS");
        }
        else if (month(nmae))
        {
            Console.WriteLine("MMYY");
        }
        else if (month(nato))
        {
            Console.WriteLine("YYMM");
        }
        else
        {
            Console.WriteLine("NA");
        }
    }

    public static bool month(int m)
    {
        if (1 <= m && m <= 12) return true;
        return false;

    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    var(int, N);

    vector<int> a(N);
    read(a);

    int ans = 0;
    int cnt = 0;
    rep(i, 0, N) {
        --a[i];

        if (a[i] == i) {
            ++cnt;
        } else {
            ans += (cnt + 1) / 2;
            cnt = 0;
        }
    }
    ans += (cnt + 1) / 2;

    print(ans);

    return 0;
}


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


ll gcd(ll c, ll d) {
  return d ? gcd(d, c%d) : c;
}

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

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

  cout << (
	   (b-a+1) - (b/c+b/d-(a-1)/c-(a-1)/d) + (b/(c/gcd(c, d)*d)) - ((a-1)/(c/gcd(c, d)*d))
	   ) << endl;
}


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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int A[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    
    int k;
    scanf("%d", &k);
    printf("%d\n", A[k - 1]);
    
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

    private void exec() {
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        scanner.nextLine();

        List<String> words = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            words.add(scanner.nextLine());
        }
        Collections.sort(words);
        StringBuilder result = new StringBuilder();
        for (String word : words) {
            result.append(word );
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define REP(i, lim) for(int i=0;i<lim;++i)
#define REPP(i, lim) for(int i=1;i<=lim;++i)
#define DEC(i, lim) for(int i=lim;i>=1;--i)
#define FOR(i,l,r)  for(int i=l;i<r;++i)
#define deBug cout<<"==================================="<<endl;
#define clr(s) memset(s, 0, sizeof(s))
#define lowclr(s) memset(s, -1, sizeof(s))
const int MAXN = 1000055;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const db eps = 1e-9;

inline int sgn(db x) { return x<-eps ? -1 : x>eps; }
inline db sqr(db x) { return x*x; }

#define cross(p1, p2, p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p3.x-p1.x)*(p2.y-p1.y))
#define crossOp(p1, p2, p3) sgn(cross(p1, p2, p3))

struct P {
    // information
    P() {}
    P(db _x, db _y) : x(_x), y(_y) {}
    db x, y;

    // operation
    P operator + (P p)   const{ return P(x+p.x, y+p.y); }
    P operator - (P p)   const{ return P(x-p.x, y-p.y); }
    P operator * (db d)  const{ return P(x*d, y*d); }
    P operator / (db d)  const{ return P(x/d, y/d); }

    db dot(P p) { return x * p.x + y * p.y; } // 点积
    db det(P p) { return x * p.y - y + p.x; } // 叉积

    // other
    void input() { scanf("%lf%lf", &x, &y); }
    void print() { printf("(%lf, %lf)\n", x, y); }

    db dis(P p) { return sqrt(sqr(x-p.x) + sqr(y-p.y)); }
    db dis2(P p) { return sqr(dis(p)); }
};

P getProjection(P a, P b, P p) {
    // (p1, q) 在 (p1, q2) 上的投影点
    P dir = b-a;
    return a + dir * ( dir.dot(p-a) / a.dis2(b) );
}

P getReflection(P a, P b, P p) {
    return getProjection(a, b, p) * 2 - p;
}

int main()
{
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//    std::ios::sync_with_stdio(false); cin.tie(0);

    P a, b;
    a.input(); b.input();
    int Q;
    scanf("%d", &Q);
    while(Q--)
    {
        P p;
        p.input();
        if(cross(a, b, p) > 0)          printf("COUNTER_CLOCKWISE\n");
        else if(cross(a, b, p) < 0 )    printf("CLOCKWISE\n");
        else{
            db dir = (b-a).dot(p-a);
            if(sgn(dir)<0)              printf("ONLINE_BACK\n");
            else {
                db dis1 = a.dis(b), dis2 = a.dis(p);
                if(sgn(dis2-dis1) > 0)  printf("ONLINE_FRONT\n");
                else                    printf("ON_SEGMENT\n");
            }
        }
    }


    return 0;
}


Measured memory_bytes: 3232
n=int(input())
lists=[0]*n
for i in range(n):
    s=int(input())
    lists[i]=(s,i)
a=sorted(lists,key=lambda x:x[0])
uselist=[0]*(n+1)
for i in range(n):
    uselist[i]=a[i][1]

cnt=0
count=1
for i in range(n):
    if uselist[i]<uselist[i+1]:
        count+=1
    else:
        cnt=max(count,cnt)
        count=1
print(n-cnt)

Measured memory_bytes: 34968
#include <stdio.h>

int main(void){
	int i,cnt=0;
	char s[3];
	scanf("%s",s);

	for(i=0;i<3;i++){
		if(s[i]=='1'){
			cnt++;
		}
	}
	printf("%d",cnt);
 
	return 0;
 
}

Measured memory_bytes: 128
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  int x;
  cin >> x;
  cout << 360 / gcd(360, x) << endl;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

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



int main(void) {
	int n, m;
	int count = 0;
	int point = 0;
	string p;
	
	cin >> n;
	vector<string>s(n);
	FOR(i, 0, n - 1) {
		cin >> s[i];
	}
	cin >> m;
	vector<string>t(m);
	FOR(i, 0, m - 1) {
		cin >> t[i];
	}

	FOR(i, 0, n - 1) {
		p = s[i];
		point = 0;
		FOR(u, 0, n - 1) {
			if (p == s[u]) {
				point++;
			}
		}
		FOR(u, 0, m - 1) {
			if (p == t[u]) {
				point--;
			}
		}
		if (point > count) {
			count = point;
		}
	}
	FOR(i, 0, m - 1) {
		p = t[i];
		point = 0;
		FOR(u, 0, n - 1) {
			if (p == s[u]) {
				point++;
			}
		}
		FOR(u, 0, m - 1) {
			if (p == t[u]) {
				point--;
			}
		}
		if (point > count) {
			count = point;
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
void solve(){
    string s; 
    cin>>s;
    for(auto c:s){
        cout<<'x';
    }
    cout<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--)solve();
	return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE FlexibleContexts, OverloadedStrings #-}
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

--  a = nb + (n+1)c
--  n = (a-c)/(b+c)
main = do
  [a,b,c] <- getInts
  print $ (a-c) `div` (b+c)


-- util
getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine



Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    vector<double> arr(len);
    for(int i = 0; i < len; i++) 
        cin >> arr[i];
    vector<double> dp(len + 1, 1);
    for(int i = 0; i < len; i++) {
        dp[i + 1] = dp[i] * arr[i];
        for(int j = i; j > 0; j--) {
            dp[j] = (dp[j - 1] * arr[i]) + (dp[j] * (1 - arr[i]));
        }
        dp[0] *= 1 - arr[i];
    }
    int index = len / 2;
    if(len % 2 == 1) 
        index++;
    double ans = 0;
    for(int i = index; i <= len; i++) 
        ans += dp[i];
    printf("%.11f", ans);
}



Measured memory_bytes: 3848
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	string s;
	cin >> s;

	int ans = 0;
	rep(i, s.size()) {
		if(s[i]-'0'==1) ans++;
	}	
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
import sys

ris=lambda:map(int,next(sys.stdin).split())

N,M,K=ris()

adj=[set() for _ in range(N)]
for _ in range(M):
    A,B=ris()
    A,B=A-1,B-1
    adj[A].add(B)
    adj[B].add(A)

colors=[-1]*N
ct={}
color=-1
for u in range(N):
    if colors[u]!=-1:
        continue
    color+=1
    colors[u]=color
    stk=[u]
    while stk:
        u=stk.pop()
        ct[color]=ct.get(color,0)+1
        for v in adj[u]:
            if colors[v]==-1:
                colors[v]=color
                stk.append(v)

blk=[{*()} for _ in range(N)]
for _ in range(K):
    A,B=ris()
    A,B=A-1,B-1
    if colors[A]==colors[B]:
        blk[A].add(B)
        blk[B].add(A)

ans=[0]*N
for u in range(N):
    c=colors[u]
    g=len(adj[u])
    b=len(blk[u])
    k=ct[c]-1-g-b
    ans[u]=k

print(*ans)


Measured memory_bytes: 139592
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	ll h, w; cin >> h >> w;
	ll n; cin >> n;
	ll a[10000] = {};
	bool r = true;
	ll c[100][100] = {};
	rep(i, 0, n) {
		cin >> a[i];
	}

	ll H = 0;
	ll W = 0;
	rep(i, 0, n) {
		while (a[i]--) {
			c[H][W] = i + 1;

			if (r) {
				W++;
			}
			else {
				W--;
			}

			if (W >= w) {
				r = false;
				H++;
				W--;
			}
			else if (W < 0) {
				r = true;
				H++;
				W++;
			}
		}
	}

	rep(i, 0, h) {
		rep(j, 0, w) {
			cout << c[i][j];
			if (j != w - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#define N 100

int G[N][N];

int main(){

  int n = 0, u = 0, k = 0, v;
  int i = 0,j = 0;

  //initialize
  for(i = 0; i < N; i++){
    
    for(j = 0; j < N; j++){
      G[i][j] = 0;
    }
    
  }

  //scan
  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      G[i][v-1] = 1;
    }
    
  }

  //print
  for(i = 0; i < n; i++){

    for(j = 0; j < n; j++){
      if(j == n-1)printf("%d",G[i][j]);
      else printf("%d ",G[i][j]);
    }

    printf("\n");
    
  }
  
  return 0;
  
}



Measured memory_bytes: 2148
import sys
K = int(input())
X, Y = map(int, input().split())
if (X + Y) % 2 and K % 2 == 0:
    print(-1)
    exit(0)

def solve(K, X, Y):
    if (X + Y) % 2 and K % 2 == 0:
        return None
    def gen(a, b, c, d):
        ans = []
        x = y = 0
        assert c-a == Y and b-d == X
        while a >= K:
            y -= K; a -= K
            ans.append((0, y))
        if a:
            x += K - a; y -= a
            b -= K - a
            ans.append((x, y))
        while b >= K:
            x += K; b -= K
            ans.append((x, y))
        if b:
            x += b; y += K - b
            c -= K - b
            ans.append((x, y))
        while c >= K:
            y += K; c -= K
            ans.append((x, y))
        if c:
            x -= K - c; y += c
            d -= K - c
            ans.append((x, y))
        while d >= K:
            x -= K; d -= K
            ans.append((x, y))
        assert X == x and Y == y, (x, y, ans)
        assert d == 0
        return ans

    ans = []
    if X + Y < K:
        if (X + Y) % 2 == 1:
            n = 3
            ans = gen(K-X, X + (K + X - Y)//2, K - X + Y, (K + X - Y)//2)
        else:
            n = 2
            ans = gen((K*n-X-Y)//2, X, (K*n-X+Y)//2, 0)
    else:
        c = (K - (X + Y)) % K
        if c % 2 == 1:
            n = (X + Y + K-1) // K + 1
        else:
            n = (X + Y + K-1) // K
        ans = gen((K*n-X-Y)//2, X, (K*n-X+Y)//2, 0)
    assert len(ans) == n
    return ans
rx = X < 0
if rx:
    X = -X
ry = Y < 0
if ry:
    Y = -Y
r = X < Y
if r:
    X, Y = Y, X
ans = solve(K, X, Y)
if ans:
    print(len(ans))
    for x, y in ans:
        if r:
            x, y = y, x
        if rx:
            x = -x
        if ry:
            y = -y
        print(x, y)
else:
    print(-1)

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

using namespace std;

typedef long long ll;

#define db(m)  cout<<#m<<" = "<<m<<"\n"

#define MAX 100000

void bang(){
    ll n, x, t; cin>>n>>x>>t;
    ll tot = (n + x - 1) / x;
    cout<<tot * t<<"\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    // int q; cin>>q;
    // while(q--)
        bang();
    return 0;
}

Measured memory_bytes: 3636
///*
#include<iostream>
using namespace std;

int main() {

	const double N = 0.006;
	int number, temperature, border;
	int *height, point = 0;
	double *air, minimum;

	cin >> number >> temperature >> border;
	height = new int[number];
	air = new double[number];

	for (int i = 0; i < number; i++) {
		cin >> height[i];
		air[i] = border - (temperature - height[i] * N);
		if (air[i] < 0)air[i] *= -1;
	}
	
	minimum = air[point];

	for (int i = 0; i < number; i++) {
		if (air[i] < minimum) {
			minimum = air[i];
			point = i;
		}
		//cout << air[i] << endl;//debug
	}

	cout <<  point + 1 << endl;
	
	delete height, air;

	return 0;
}
//*/

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

int main() {
  int n;
  cin >>n;
  int v[n],c[n];
  for(int i=0;i<n;i++) cin>>v[i];
  for(int i=0;i<n;i++) cin>>c[i];
  int ans=0;
  for(int i=0;i<n;i++) {
    if(v[i]>c[i]) ans += v[i]-c[i];
  }
  cout<<ans<<endl;

  }


Measured memory_bytes: 256
from sys import stdin
input = stdin.readline


def main():
  S = input()[:-1]
  T = input()[:-1]

  t_start_idx = []
  for si, s in enumerate(S):
    # print(f's:{s}')
    if not(s == T[0]) and not(s == '?'):
      continue
    cur_si = si
    for t in T:
      # print(f't:{t}')
      if cur_si >= len(S): break
      if not(t == S[cur_si]) and not(S[cur_si] == '?'):
        break
      cur_si += 1
    else:
      t_start_idx.append(si)
      continue

  if not len(t_start_idx):
    print('UNRESTORABLE')
    return

  new_S = S[:t_start_idx[-1]] + T + S[t_start_idx[-1]+len(T):]
  # print(new_S)

  ret_s = ''
  for s in new_S:
    if s == '?':
      ret_s += 'a'
    else:
      ret_s += s

  print(ret_s)


if(__name__ == '__main__'):
  main()

Measured memory_bytes: 9008
#include <stdio.h>


void trace(int A[],int N) {
	int i;
	for(i=0;i<N;i++) {
		if(i>0) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N) {
	int i,j,v;
	for(i=1;i<N;i++) {
		v=A[i];
		j=i-1;
		while(j>=0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
	}
}

int main(void)
{
	int N, i, j;
	int A[100];
	scanf("%d",&N);
	for(i=0;i<N;i++) scanf("%d",&A[i]);
	
	trace(A,N);
	insertionSort(A,N);
	return 0;
}


Measured memory_bytes: 2040
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int N = NM[0], M = NM[1];

        var G = new Graph(N);
        var parents = new Graph(N);
        var Degrees = new int[N];

        for (int i = 0; i < N+M-1; i++)
        {
            var r = Console.ReadLine().Split().Select(_=>int.Parse(_)-1).ToArray();
            G.Add(r[0], r[1]);
            parents.Add(r[1], r[0]);
            Degrees[r[1]]++;
        }

        var sorted = new List<int>(Topologicalsort(G, Degrees));
        var sortedpos = new int[N];
        for (int i = 0; i < N; i++)
        {
            sortedpos[sorted[i]] = i;
        }

        for (int i = 0; i < N; i++)
        {
            int parent = -1;
            int parentpos = -1;
            foreach (var j in parents[i])
            {
                if (parentpos < sortedpos[j])
                {
                    parent = j;
                    parentpos = sortedpos[j];
                }
            }
            Console.WriteLine(parent+1);
        }
    }

    static List<int> Topologicalsort(Graph G, int[] Degrees)
    {
        var que = new Queue<int>();
        for (int i = 0; i < Degrees.Length; i++)
        {
            if (Degrees[i] == 0)
                que.Enqueue(i);
        }

        var sorted = new List<int>();
        while (que.Count > 0)
        {
            var v = que.Dequeue();
            sorted.Add(v);
            foreach (var i in G[v])
            {
                Degrees[i]--;
                if (Degrees[i] == 0)
                    que.Enqueue(i);
            }
        }
        return sorted;
    }
}

class Graph
{
    private List<int>[] G;
    public Graph(int size)
    {
        G = new List<int>[size];
        for (int i = 0; i < size; i++)
        {
            G[i] = new List<int>();
        }
    }

    public List<int> this[int i] => G[i];
    public void Add(int from, int to) => G[from].Add(to);
    public List<int>[] ToListArray() => G;

}


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

long long A,B;
long long gcd(long long x,long long y){
	if(x>y) swap(x,y);
	if(x==0) return y;
	return gcd(y%x,x);
}
long long lcm(long long x,long long y){
	return x*y/gcd(x,y);
}

int main(){
	scanf("%lld%lld",&A,&B);
	printf("%lld\n",lcm(A,B));
	return 0;
}

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

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> PII;
typedef long long LL;
typedef unsigned long long ULL;

//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);

//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;

int main() {
  int A = 0, B = 0;
  int p;

  REP(i, 2) {
    REP(j, 4) {
      cin >> p;
      if(!i) A += p;
      else B += p;
    }
  }
  if(A > B) cout<< A << endl;
  else cout << B << endl;
}

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

using namespace std;

int main()
{
    string s,t,u;
    int a,b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if(s==u) a--;
    if(t==u) b--;

    cout << a << " " << b << endl;
}

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

void compress(vector<int>& xs) {
	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());
}

bool solve() {
	int N;
	cin >> N;
	if (N == 0) return false;

	vector<int> x(N), y(N), xa(4), ya(4), xs(N + 4), ys(N + 4);
	for(int i = 0; i < N; ++i) {
		cin >> x[i] >> y[i];
		xs[i] = x[i];
		ys[i] = y[i];
	}
	for(int i = 0; i < 4; ++i) {
		cin >> xa[i] >> ya[i];
		xs[i + N] = xa[i];
		ys[i + N] = ya[i];
	}

	compress(xs);
	compress(ys);

	auto isin = [&](int i, int j, vector<int>& xv, vector<int>& yv) {
		int K = xv.size();

		int cnt = 0;
		for(int k = 0; k < K; ++k) {
			int tx0 = xv[k],           ty0 = yv[k];
			int tx1 = xv[(k + 1) % K], ty1 = yv[(k + 1) % K];

			if (tx0 < xs[i + 1] || tx1 < xs[i + 1]) continue;

			if (ty0 > ty1) swap(ty0, ty1);
			if (ty0 <= ys[j] && ys[j + 1] <= ty1) ++cnt;
		}
		return cnt % 2;
	};

	int ans = 0;

	for(int i = 0; i + 1 < xs.size(); ++i) {
		for(int j = 0; j + 1 < ys.size(); ++j) {
			// cerr << (isin(i, j, x, y) && !isin(i, j, xa, ya)) << " ";
			if (isin(i, j, x, y) && !isin(i, j, xa, ya)) {
				ans += (xs[i + 1] - xs[i]) * (ys[j + 1] - ys[j]);
			}
		}
		// cerr << endl;
	}

	cout << ans << endl;
	return true;
}


int main() {
	while(solve());
	return 0;
}



Measured memory_bytes: 3152
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string.h>
#include <math.h>
typedef long long ll;
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;

string a,b,c;

int main() {
	cin >> a >> b >> c;
		
	cout << a[0] << b[1] << c[2];

	return 0;
}


Measured memory_bytes: 256
# ABC061C - Big Array
import sys
input = sys.stdin.readline

def main():
    n, k = list(map(int, input().rstrip().split()))
    memo = [0] * (10 ** 5 + 1)
    for _ in range(n):
        i, j = map(int, input().rstrip().split())
        memo[i] += j
    cnt = 0
    for i, j in enumerate(memo):
        cnt += j
        if cnt >= k:
            print(i)
            break


if __name__ == "__main__":
    main()

Measured memory_bytes: 5740
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct edge{
    int to;
    long long d;
};
int main(){
    int N, M;
    cin >> N >> M;
    vector<edge> G[N];
    for(int i = 0; i < M; i++){
        int L, R;
        cin >> L >> R;
        long long D;
        cin >> D;
        L--;
        R--;
        edge e = {R, D}, e2  = {L, -D};
        G[L].push_back(e);
        G[R].push_back(e2);
    }
    long long INF = 1e18;
    vector<long long> x(N, INF);
    for(int i = 0; i < N; i++){
        if(x[i] != INF) continue;
        x[i] = 0;
        queue<int> q;
        q.push(i);
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(edge e: G[v]){
                if(x[e.to] == INF){
                    x[e.to] = x[v] + e.d;
                    q.push(e.to);
                }
                else if(x[e.to] != x[v] + e.d){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 16876
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char* argv[])
{
  int N, W;
  cin >> N >> W;
  vector<int> v(N);
  vector<int> w(N);
  for (int i=0; i<N; i++) {
    cin >> w[i] >> v[i];
  }
  
  vector< vector<long long> > b(N);
  for (int i=0; i<N; i++) b[i].resize(W+1);
  
  for (int i=N-1; i >= 0; i--) {
    for (int j=0; j<=W; j++) {
      if (i == N-1) {
        if (w[i] > j) {
          b[i][j] = 0;
        } else {
          b[i][j] = (long long)v[i];
        }
      } else {
        if (w[i] > j) {
          b[i][j] = b[i+1][j];
        } else {
          //cout << (long long)v[i] + b[i+1][j-w[i]] << ", " << b[i+1][j] << "\n";
          //cout << j - w[i] << "\n";
          //cout << v[i] << " " << (long long)v[i] << " " << b[i+1][j-w[i]] << "\n";
          b[i][j] = max((long long)v[i] + b[i+1][j-w[i]], b[i+1][j]);
        }
      }
      //cout << i << " " << j+1 << " " << b[i][j] << "\n";
    }    
  }  
  cout << b[0][W] << "\n";
  return 0;
}


Measured memory_bytes: 78592
#include <iostream>

using namespace std;

int main(){
	int a;
	int i=1;
	
	while(1){
		cin >> a;
		if(a == 0){
			break;
		}
		else{
			cout << "Case" << " " << i << ":" << " " << a << endl;
			i++;
		}
}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <set>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}


int main(){
    LL N;
    cin >> N;

    LL ans = 0;
    for(LL i=1; i<=N; i++){
        LL count = N/i;

        ans += i * (count * (count+1))/2;
    }

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

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

const int mxN=1e5+1;

void solve(){
    int n;
    cin>>n;
    int count_pairs = 0;
    for (int i = 1; i <= sqrt(n - 1); ++i) {
        for (int j = i; j * i < n; ++j)
            ++count_pairs;
    }
    count_pairs *= 2;
    count_pairs -= (int)(sqrt(n - 1));
    cout<<count_pairs<<endl;
}

signed main(){
    int t;
//    cin>>t;
//    while(t--){
        solve();
//    }
}

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

using namespace std;

int N, Y;
int xx = -1, yy = -1, zz = -1;

void f() {
  for(int x = 0; x <= 2000; x++) {
    for(int y = 0; y <= 2000; y++) {
      if(N-x-y >= 0 && 1000*x + 5000*y + 10000*(N-x-y) == Y) {
        xx = x; yy = y; zz = N-x-y;
        return;
      }
    }
  }
}

int main() {
  cin >> N >> Y;
  f();
  cout << zz << " " << yy << " " << xx << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int n,m,q;
vector<int> a(100),b(100),c(100),d(100);
int ans = 0;
vector<int> v;

void dfs(){
  if(v.size()==n){
    int cur = 0;
    rep(i,q){
      if(v[b[i]]-v[a[i]] == c[i]) cur += d[i];
      ans = max(ans, cur);
    }
    return;
  }
  int st = (v.size()!=0 ? v.back():1);
  for(int i=st; i<=m; i++){
    v.emplace_back(i);
    dfs();
    v.pop_back();
  }
}

int main(){
  cin >> n >> m >> q;
  rep(i,q){ cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--; b[i]--; }
  dfs();
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    int n, k;
    cin>>n>>k;
    cout<<(n+k-1)/k;  
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-06-25 16:13:15 +0900
# LastModified: 2020-06-25 16:26:22 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    s = input()
    total = 0
    for i in range(1,n):
        cnt = 0
        left = s[:i]
        right = s[i:]
        left = list(set(left))
        right = list(set(right))
        for l in left:
            if l in right:
                cnt += 1
        if total < cnt:
            total = cnt
    print(total)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

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

using namespace std;

typedef long long int lli;

int main () {
    int N;
    cin >> N;
    map<int, int> a;
    REP (i, 0, N) {
        int ai;
        cin >> ai;
        a[ai]++;
    }
    lli ans = 0;
    int cnt = 0;
    for (auto it = a.rbegin(); it != a.rend(); it++) {
        if (it->second >= 2) {
            if (cnt == 0) ans = it->first;
            if (cnt == 1) ans = ans * (it->first);
            cnt++;
        }
        if (cnt <= 1 && it->second >= 4) {
            ans = ((lli)it->first) * it->first;
            cnt = 2;
        }
        if (cnt == 2) break;
    }
    if (cnt == 1) ans = 0;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
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 FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    string s, f, b;
    int q;
    cin >> s >> q;
    bool swap = false;
    while (q--){
        int t = in();
        if (t == 1){
            swap ^= 1;
        }else{
            int u = in() - 1;
            char c;
            cin >> c;
            if ((swap ^ u) == 0) f += c;
            else b += c;
        }
    }
    reverse(ALL(f));
    string ans = f + s + b;
    if (swap) reverse(ALL(ans));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1348
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
k = []
j = 0
na= 0
c = 0
for i in range(n):
    if a[i]<b[i]:
        na +=b[i]-a[i]
        c+=1
    elif a[i] > b[i]:
        k.append(a[i]-b[i])
k.sort()
while na > 0 and k:
    na -=k[-1]
    k.pop(-1)
    c +=1
if na > 0:print(-1)
else:print(c)

Measured memory_bytes: 18356