akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod=1e9+7;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int mod=0;
    string s;cin>>s;
    for(auto it:s)
    {
    	int d=it-'0';
    	mod+=d;
    	mod%=9;
    }
    yesno(mod==0);

    return 0;
}

Measured memory_bytes: 3784
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

alias D = Tuple!(long, "sum", int, "i", int, "j", int, "k");

void calc_pq(int K, long[] a, long[] b, long[] c) {
    a.sort!("a > b");
    b.sort!("a > b");
    c.sort!("a > b");
    auto pq = new BinaryHeap!(Array!D);
    bool[Tuple!(int, int, int)] used;
    pq.insert(D(a[0] + b[0] + c[0], 0, 0, 0));
    while (K > 0) {
        auto d = pq.front;
        pq.popFront();
        if (tuple(d.i, d.j, d.k) in used) continue;

        writeln(d.sum);
        used[tuple(d.i, d.j, d.k)] = true;
        K--;

        int i = d.i;
        int j = d.j;
        int k = d.k;
        if (i + 1 < a.length)
            pq.insert(D(a[i + 1] + b[j] + c[k], i + 1, j, k));
        if (j + 1 < b.length)
            pq.insert(D(a[i] + b[j + 1] + c[k], i, j + 1, k));
        if (k + 1 < c.length)
            pq.insert(D(a[i] + b[j] + c[k + 1], i, j, k + 1));
    }
}

void calc(int k, long[] a, long[] b, long[] c) {
    long[] ab;
//    foreach (x, y; cartesianProduct(a, b))
//        ab ~= x + y;
    foreach (x; a) foreach (y; b) ab ~= x + y;

    ab.sort!"a > b";
    c.sort!"a > b";
    long[] abc;
//    foreach (x, y; cartesianProduct(c, ab.take(k)))
//        abc ~= x + y;
    foreach (x; c) foreach (y; ab.take(k))
        abc ~= x + y;
    abc.sort!"a > b";
    foreach (e; abc.take(k)) writeln(e);
}

void main() {
    int x, y, z, k; scan(x, y, z, k);
    auto a = reads!long;
    auto b = reads!long;
    auto c = reads!long;


    calc(k, a, b, c);
}


Measured memory_bytes: 59644
#include<bits/stdc++.h>
using namespace std;
int n,maxx,i,j,k,minn,c,l,r;
int a[100007];
int main(){
    cin>>n;maxx=0;minn=999999999;l=1;r=1;int ans=0;
    for(i=1;i<=n;i++)
    	cin>>a[i];
    sort(a+1,a+n+1);
    for(i=1;i<=n;i++){
    	if(a[i]==a[i+1]){
    		i++;continue; 
		}
		ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x); cout<<#x<<"="<<x<<endl;
#define watch2(x,y); cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define endl "\n"
#define int long long
using namespace std;        
 


int32_t main(){

    fast
    string s;
    string t;
    cin>>s>>t;
    int n=s.size();
    if(s==t.substr(0,s.size())){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }




    return 0;
}



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

int main(){
  string S; cin >> S;
  ll K;  cin >> K;
  ll m = S.size();
  
  bool same = true;
  for(ll i = 0; i < m-1; i++){ if( S[i] != S[i+1]){ same = false;} }
  if(same){ cout << (m*K)/2 << endl; return 0;}
 
  ll cnt1 = 0; ll cnt2 = 0;
  string SS = S+S;
  
  ll head = 0; ll tail = 0;
  while(head < m && tail < m){
    
    if( S[head] != S[tail]){
      if( head == tail){head++; tail++;}
      else{ head++;}continue;}
    
    while(head < m && tail < m && S[head] == S[tail]){ tail++;}
    cnt1 += (tail-head)/2;
    head = tail;
  }
  
  head = 0; tail = 0;
  
  while(head < 2*m && tail < 2*m){
    
    if( SS[head] != SS[tail]){
      if( head == tail){head++;tail++;}
      else{ head++;}continue;}
    
    while(head < 2*m && tail < 2*m && SS[head] == SS[tail]){ tail++;}
    cnt2 += (tail-head)/2;
    head = tail;
  }
    
  ll y = cnt2-2*cnt1;
  ll x = cnt1;
  
  cout << K*x+(K-1)*y << endl; return 0;}

Measured memory_bytes: 256
#include<cstdio>
#define maxn 100050
using namespace std;
int a[maxn];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++){
		int l,r;
		scanf("%d%d",&l,&r);
		a[l]++,a[r+1]--;
	}
	int ans=0;
	for (int i=1;i<=n;i++){
		a[i]+=a[i-1];
		if (a[i]==m) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    ans = 0.0
    if N >= K:
        ans += (N - K + 1) / N
    k = K
    p = 1.0
    while k > 1:
        j = -(-k // 2)
        p /= 2.0
        ans += (min(k, N + 1) - min(j, N + 1)) / N * p
        k = j
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
mod = 10 ** 9 + 7
n, k = [ int(v) for v in input().split() ]

num_list = [ int(v) for v in input().split() ]
num_list_2 = [ i - 1 for i in num_list ]
t_list = []
ts_list = []
for i, v in enumerate(num_list):
    t = 0
    s = 0
    for j in range(i):
        if num_list[j] < v:
            s += 1
    for j in range(i+1,n):
        if num_list[j] < v:
            t += 1
    t_list.append(t)
    ts_list.append(t+s)


a = ( k * (k-1) )  // 2
a = a % mod

print( (sum(ts_list)*a+ k*sum(t_list) ) % mod )


Measured memory_bytes: 42476
f=lambda:[*map(int,input().split())]
H,W=f()
r=range(10)
c=[f() for _ in r]
C=[0]*10

for _ in range(H):
  for i in f():
    if i>=0:
      C[i]+=1

for k in r:
  for i in r:
    for j in r:
      c[i][j]=min(c[i][j],c[i][k]+c[k][j])

print(sum(c[i][1]*C[i] for i in r))

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

using ll  = long long;
using pii = pair<int,int>;
#define dbg(n) cout<<'\n'<<#n<<" is "<<n<<'\n';
#define pb push_back
#define all(v) v.begin(), v.end()
#define cs(i) cout<<"Case "<<i+1<<": \n"; 
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"

const int N   = 2e5+5;
const int INF = 0x7fffffff;



int main(){
    int n,t,hold=0; 
    FAST
    string s1,s2;
    cin>>s1>>s2;
    if(s1.size()>s2.size()) swap(s1,s2);
    for(int i=0;i<s1.size();i++){
        if(s1[i]!=s2[i]) hold++;
    } cout<<hold<<endl;
    
    return 0;
}

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

#define MAX_SIZE 100000

int main(void)
{
    int n, A[MAX_SIZE];
    cin >> n;

    for(int i = 0; i < n; i++) scanf("%d", &A[i]);

    int last = -1;
    int x = A[n-1];

    for(int i = 0; i < n-1; i++)
    {
        if(A[i] <= x){
            last++;
            swap(A[i], A[last]);
        }
    }

    swap(A[last + 1], A[n - 1]);

    for(int i = 0; i < n; i++)
    {
        if(i) cout << " ";
        if(i == last + 1) cout << '[';
        cout << A[i];
        if(i == last + 1) cout << ']';
    }

    cout << endl;

    return 0;

}


Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k-1] = tolower(s[k-1]);
	cout << s << "\n";
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){
	int N;
	cin>>N;
	string S;
	cin>>S;

	map<string, int> pam;
	string init=to_string(S[0]-'0');
	//cout<<"!"<<init<<endl;
	pam[init]++;
	for(int i=1;i<S.length();i++){
		vector<string> vec;
		for(auto p:pam){
			string str;
			int a;
			tie(str, a)=p;

			if(str.length()<3)
				vec.pb(str+to_string(S[i]-'0'));
		}
		pam[to_string(S[i]-'0')]++;
		for(string str:vec){
			//cout<<str<<endl;
			pam[str]++;
		}
	}
	int ans=0;
	for(auto p:pam){
		string str;
		int a;
		tie(str, a)=p;

		if(str.length()==3)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 384
using System.Collections.Generic;
using System;

public class Key
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<char, Key>();
        var map = new char[,] { { 'A', 'B', 'C' }, { 'D', 'E', 'F' }, { 'G', 'H', 'I' } };
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++) d[map[i, j]] = new Key { x = i, y = j };
        var dx = new int[] { 0, 1, 0, -1 };
        var dy = new int[] { 1, 0, -1, 0 };
        for (int i = 0; i < 1000; i++)
        {
            var s = Console.ReadLine().Trim();
            if (checkPw(d, map, s, dx, dy)) Console.WriteLine(s);
        }
    }
    public static bool checkPw(Dictionary<char, Key> d, char[,] map, string s, int[] dx, int[] dy)
    {
        var prekey = s[0];
        for (int i = 1; i < s.Length; i++)
        {
            var okflg = false;
            for (int j = 0; j < 4; j++)
            {
                var nx = d[prekey].x + dx[j];
                var ny = d[prekey].y + dy[j];
                if (nx >= 0 && nx < 3 && ny >= 0 && ny < 3 && map[nx, ny] == s[i]) okflg = true;
            }
            if (okflg) prekey = s[i];
            else return false;
        }
        return true;
    }
}

Measured memory_bytes: 9468
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N; cin >> N;
    vector<pair<long long, long long>> tasks(N);
    for (int i = 0; i < N; i++) {
        long long a, b; cin >> a >> b;
        tasks[i] = {b, a};
    }
    sort(tasks.begin(), tasks.end());
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        sum += tasks[i].second;
        if (sum > tasks[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int xcom(int,int);
int ycom(int,int,int,int);
int main(){
	int a,b,c,d,p,mx,my;
	cin>>a>>b>>c>>d>>p;
	mx=xcom(a,p);
	my=ycom(b,c,d,p);
	if(mx<=my){
		cout<<mx<<endl;
	}else{
		cout<<my<<endl;
	}
	return 0;
}
int xcom(int a,int p){
	return p*a;
}
int ycom(int b,int c,int d,int p){
	if(c<p){
		return (p-c)*d+b;
	}else{
		return b;
	}
}

Measured memory_bytes: 3124
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    print(int(input())*2*3.1415926535)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61864
#include <iostream>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <cstdio>
#include <bitset>
#include <map>
#include <string>


using namespace std;

int main()
{
    //failure, out of range
    // long long x;

    // while (cin >> x)
    // {
    //     if (x == 0)
    //         break;

    //     int sum = 0;
    //     do
    //         sum += x%10;
    //     while (x /= 10);
    //     cout << sum << endl;;
    // }

    //method 1
    // string  digits;

    // while (cin >> digits)
    // {
    //     if (digits == "0")
    //         break;

    //     int sum = 0;

        //method 1
        // string::iterator it = digits.begin();
        // while (it != digits.end())
        // {
            // method 1
            // sum += *it - '0';

            // method 2, require C++11
            // string str = {*it};
            // sum += stoi(str);

            //method 3
            // char ch[2] = {*it}; //require one more byte to store \0
            // sum += atoi(ch);

            //method 4, convert string to string 
            // sum += stoi(digits.substr(it-digits.begin(), 1));  

        //     it++;
        // }

        //method 2
        // for (int i = 0; i < digits.size(); i++)
        // {
        //     //method 1, convert string to string 
        //     // sum += stoi(digits.substr(i, 1));        

        //     //method 2, convert string to char[] using string::copy
        //     char ch[2] = {};
        //     digits.copy(ch, 1, i);
        //     sum += atoi(ch);   

                //method 3, using string::c_str to convert string to char[]
    //             const char * c = digits.c_str(); //why can not use char[]?
    //             char ch[2] = {c[i]};
    //             sum += atoi(ch); 
    //     }







    //     cout << sum << endl;
    // }
    
    //method 2
    // char ch;
    // int sum = 0;
    // while (cin.get(ch))
    // {
    //     if (ch == '0' && sum == 0)
    //         break;
    //     else if (ch == '\n')
    //     {
    //         cout << sum << endl;
    //         sum = 0;                
    //     }
    //     else// if (ch > '0' && ch <= '9')
    //     {
    //         sum += ch - '0';
    //     }
    // }

    //method 3
    int sum = 0;
    char ch;
    while (true)
    {
        while ((ch = cin.get()) != '\n')
            sum += ch - '0';
        
        if (sum == 0)
            break;

        cout << sum << endl;
        sum = 0;            


    }
}


Measured memory_bytes: 3092
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    }
}


Measured memory_bytes: 22996
N = gets.to_i
as = gets.split.map(&:to_i)

# 区間の和を使うので累積和を前計算
accum = as.dup
(N-1).times do |i|
    accum[i+1] += accum[i]
end

ans = 10**20

# 区間2つ+区間2つの境界を全探索
# [0, center] と [center+1, N-1] に分ける
(1..(N-3)).each do |center|
    sum_l = accum[center]
    sum_r = accum[N-1] - accum[center]
    parts = []

    # s1を半分に分ける。
    mid = (1..center).bsearch{|i| accum[i]*2 > sum_l}
    s11, s21 = accum[mid], accum[mid-1]
    s12, s22 = sum_l - s11, sum_l - s21
    if (s11 - s12).abs < (s21 - s22).abs
        parts.push(s11, s12)
    else
        parts.push(s21, s22)
    end

    # s2を半分に分ける
    mid = ((center+2)...N).bsearch{|i| (accum[i] - sum_l)*2 > sum_r}
    s11, s21 = accum[mid]-sum_l, accum[mid-1]-sum_l
    s12, s22 = sum_r - s11, sum_r - s21
    if (s11 - s12).abs < (s21 - s22).abs
        parts.push(s11, s12)
    else
        parts.push(s21, s22)
    end

    result = parts.max - parts.min
    ans = result if ans > result
end
puts ans

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

using namespace std;

int main() {
  string s;
  cin >> s;
  string ans = "";
  for (int i = 0; i < s.size(); i++) {
    if(i % 2 == 0) {
      ans += s[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

int N,i;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N >> i;
  cout << N - i + 1 << endl;

  return 0;
}


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


int S;
int h, m, s;

int main(void) {
  cin >> S;

  s = S % 60;
  m = (S / 60) % 60;
  h = S / 3600;

  cout << h << ":" << m << ":" << s << endl;

  return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    if (A % 2 == B % 2) {
        cout << abs(A - B) / 2 << endl;
        return 0;
    }

    cout << min(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
}

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

int n,m,ans=0;
int a[105][105];

bool judge_square(int x)
{
	int y=sqrt(1.00*x);
	if (y*y==x)  return true;
	else return false;
}

signed main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)  cin>>a[i][j];
	}
	for (int i=1;i<=n-1;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			int tot=0;
			for (int k=1;k<=m;k++)  tot=tot+(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
			if (judge_square(tot))  ans++;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var d = int.Parse(line[1]);
            var n = int.Parse(line[2]);
            if (a == 0 && d == 0 && n == 0) break;
            Console.WriteLine(getAns(a, d, n));
        }
    }
    public static int getAns(int a, int d, int n)
    {
        var count = 0; var i = 0;
        var targ = 0;
        while (n > count)
        {
            targ = a + d * i++;
            if (IsPrime(targ)) count++;
        }
        return targ;
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        else if (n == 2) return true;
        else if (n % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i <= sqrtNum; i += 2)
            if (n % i == 0) return false;
        return true;
    }
}

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

int main(void){
    int n;
    
    while(cin>>n){
        if(n==0) break;
    int m[n],p[100][100]={0};
    for(int i=0;i<n;i++){
        cin>>m[i];
        for(int j=0;j<m[i];j++){
            cin>>p[i][j];
            }
    }
    int k;
    cin>>k;
    int l[k];
    for(int i=0;i<k;i++){
        cin>>l[i];
    }
    int s=0,ans[100]={-1};
    for(int i=0;i<n;i++){
        int g=0;
        bool div=true;
        while(div){
            div=false;
            for(int j=0;j<m[i];j++){
                if(l[g]==p[i][j]){
                    div=true;
                    g++;
                
                    if(g==k){
                        ans[s++]=i+1;
                    }
                }
            }
        }
    }
    if(ans[1]>0) cout<<-1<<endl;
    else cout<<ans[0]<<endl;
    
    }

}

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

using namespace std;

const int mod = 1e9 + 7;
int fact[100000+10];
int a[100000 + 10];

int Pow(int a, int n) {
    if (a == 1)
        return 1;
    int res = 1;
    while (n) {
        if (n&1) {
            res = (1LL * res * a) % mod;
        }
        a = (1LL * a*a) % mod;
        n >>= 1;
    }
    return res;
}

int inverse(int a, int mod) {
    return Pow(a, mod-2);
}

int c_n_k(int n, int k) {
    if (k > n)
        return 0;
    if (n <= 0)
        return 0;
    if (k < 0)
        return 0;
    if (k == 0)
        return 1;
    else
        return ((1LL * ((1LL * fact[n] * inverse(fact[k], mod)) % mod) * inverse(fact[n-k], mod)) % mod) % mod;
}

void solve() {
    int n;
    int ansi;
    int r,l;
    cin >> n;
    fact[0] = 1;
    for (int i=1; i <=n+1; ++i) {
        fact[i] = ((long long)fact[i-1] * i) % mod;
    }
    for (int i=1; i <= n+1; ++i) {
        int ai;
        cin >> ai;
        if (a[ai] != 0) {
            r = i-1;
            l = a[ai]-1;
            break;
        }
        a[ai] = i;
    }
    //cout << l << " " << r << endl;
    cout << n <<endl;
    for (int k=2; k < n+1; ++k) {
        int ansi = 0;
        long long temp;
        ansi = (ansi + c_n_k(n+1, k)) % mod;
        ansi = (ansi - c_n_k(n+1-(r-l+1), k-1)) % mod;
        if (ansi < 0)
            ansi += mod;
        cout << ansi << endl;
    }
    cout << 1;
}

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


Measured memory_bytes: 3876
#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main(void){
    long int N = 0,ans = 0,val = 0,val2 = 0;
    cin >> N;
    val = sqrtf(N);
    while(val != 0){
        ans = N % val;
        if(ans == 0){
            ans = N / val;
            break;
        }
        val -= 1;
    }
    val2 = (val - 1) + (ans - 1);
    cout << val2;
    return 0;
}


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

int main(){

    string str, command;
    cin >> str;

    int q;
    cin >> q;

    for(int i=0; i<q; i++){
        int a, b;
        cin >> command;
        if(command=="print"){
            cin >> a >> b;
            for(int j=a; j<b+1; j++){
                cout << str[j];
            } 
            cout << endl;
        }else if(command=="reverse"){
            cin >> a >> b;
            string tmp;
            for(int j=a; j<b+1; j++){
                tmp.push_back(str[j]);
            }
            for(int j=a; j<b+1; j++){
                str[a+b-j] = tmp[j-a];
            }
            tmp.clear();
        }else if(command=="replace"){
            cin >> a >> b;
            string tmp;
            cin >> tmp;
            for(int j=a; j<b+1; j++){
                str[j] = tmp[j-a];
            }
            tmp.clear();
        }
    }

    return 0;
}



Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ull unsigned ll
#define pb push_back

using namespace std;

double dp[3000][3000];

int main(){
	int n;cin>>n;
	double a[n+1];
	for(int i=1;i<=n;i++)cin>>a[i];
	dp[1][0]=1-a[1];
	dp[1][1]=a[1];
	for(int i=2;i<=n;i++){
		dp[i][0]=dp[i-1][0]*(1-a[i]);
		for(int j=1;j<=i;j++){
			dp[i][j]=dp[i-1][j-1]*a[i]+dp[i-1][j]*(1-a[i]);
		}
	}
	double cnt=0;
	for(int i=(n+1)/2;i<=n;i++){
		cnt+=dp[n][i];
	}
	cout<<fixed<<setprecision(10)<<cnt;
	return 0;
}


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

int main()
{
    string s;
    cin >> s;
    if(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi" ){
       cout << "Yes" << endl; 
    }
    else
    {
       cout << "No" << endl;
    }
    return 0;
}




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

d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))

sunuke = [0] * (n+1)

for i in range(k):
    tmp = d[i]
    for j in range(tmp):
        sunuke[a[i][j]] += 1

print(sunuke.count(0)-1)

Measured memory_bytes: 9200
// ACM-ICPCà\I2010 A. ppæC©­YÝ«

#include <iostream>

using namespace std;

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

int main(){
	int N;
	int x[200], y[200];
	x[0] = y[0] = 0;
	while(cin >> N, N){
		for(int i=0;i<N-1;i++){
			int ni, di; cin >> ni >> di;
			x[i+1] = x[ni] + dx[di];
			y[i+1] = y[ni] + dy[di];
		}
		int minx = 0, maxx = 0, miny = 0, maxy = 0;
		for(int i=0;i<N;i++){
			minx = min(minx, x[i]);
			maxx = max(maxx, x[i]);
			miny = min(miny, y[i]);
			maxy = max(maxy, y[i]);
		}
		cout << (maxx-minx+1) << " " << (maxy-miny+1) << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
ll c(ll x){
  return x*(x-1)/2;
}

int main() {
  int n;
  cin >> n;
  vector<int>A(n);
  rep(i,n) cin >> A.at(i);
  rep(i,n) A.at(i)--; 
  vector<int>cnt(n);
  rep(i,n) cnt.at(A.at(i))++;
  ll sum = 0;
  rep(i,n) sum += c(cnt.at(i));
  rep(i,n){
    ll ans = sum;
    ans -= c( cnt.at( A.at(i) ) );
    ans += c( cnt.at( A.at(i)) -1 );
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 200100;

int p1[N], p2[N], r1[N], r2[N];

int get_root(int p[], int v) {
    if (p[v] == v) {
        return v;
    }
    return p[v] = get_root(p, p[v]);
}

void un(int p[], int r[], int v, int u) {
    v = get_root(p, v);
    u = get_root(p, u);
    if (r[v] < r[u]) {
        swap(v, u);
    }
    if (r[v] == r[u]) {
        ++r[v];
    }
    p[u] = v;
}

map<pair<int, int>, int> kek;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k, l;
    cin >> n >> k >> l;
    for (int i = 1; i <= n; ++i) {
        p1[i] = i;
        p2[i] = i;
    }
    while (k--) {
        int a, b;
        cin >> a >> b;
        un(p1, r1, a, b);
    }
    while (l--) {
        int a, b;
        cin >> a >> b;
        un(p2, r2, a, b);
    }
    for (int i = 1; i <= n; ++i) {
        ++kek[{ get_root(p1, i), get_root(p2, i) }];
    }
    for (int i = 1; i <= n; ++i) {
        cout << kek[{ get_root(p1, i), get_root(p2, i) }] << ' ';
    }
    return 0;
}

Measured memory_bytes: 13696
N = str(input())

Ns = 0

for x in N:
    Ns = Ns + int(x)

loops = 0
while Ns > 10:
    Ns_str = str(Ns)
    Ns = 0
    for x in Ns_str:
        Ns = Ns + int(x)
    loops = loops + 1
    if loops > 1000000:
        break

if Ns == 9 or Ns == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9236
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)




int main() {
    int n;
    cin >> n;
    
    while(n != 0){
        vector<int> imos(1e5);
        REP(i, n){
            int hh, mm, ss;
            
            scanf("%d:%d:%d", &hh, &mm, &ss);
            int t = hh * 3600 + mm * 60 + ss;
            imos[t]++;
            
            scanf("%d:%d:%d", &hh, &mm, &ss);
            t = hh * 3600 + mm * 60 + ss;
            imos[t]--;
        }
        
        int ans = imos[0];
        for(int i = 1; i < 1e5; i++){
            imos[i] += imos[i - 1];
            ans = max(ans, imos[i]);
        }
        cout << ans << endl;
        
        cin >> n;
    }
}



Measured memory_bytes: 3524
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int second_per_day = 86400;

int to_sec(int hour, int minute, int second) {
  return hour * 3600 + minute * 60 + second;
}

int main() {
  int depature_times;
  vector<int> times(second_per_day, 0);

  while(true) {
    cin >> depature_times;

    if(depature_times == 0) {
      break;
    }

    // clear
    for(int i = 0; i < times.size(); i++) {
      times[i] = 0;
    }

    // preprocess
    for(int i = 0; i < depature_times; i++) {
      int hour, minute, second;

      // Deaptrue
      scanf("%d:%d:%d", &hour, &minute, &second);
      times[to_sec(hour, minute, second)] += 1;

      // Arrive
      scanf("%d:%d:%d", &hour, &minute, &second);
      times[to_sec(hour, minute, second)] += -1;
    }

    // simulate
    int tmp_max = times[0];
    for(int i = 1; i < times.size(); i++) {
      times[i] += times[i - 1];
      tmp_max = max(times[i], tmp_max);

      if(tmp_max == 4) {

      }
    }

    cout << tmp_max << endl;
  }
}


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

int h, w, n;
int d[4] = {0, 1, 0, -1};
string s[33], now[33], tmp[33];

bool solve();
bool search();
bool ch(int x, int y);

int main() {
  cin >> h >> w >> n;
  for(int i = 0; i < h; ++i) cin >> s[i];
  if(solve())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

bool solve() {
  for(int i = 0; i < h; ++i) now[i] = s[i];
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j) {
      int nx = i, ny = j + 1;
      if(!ch(i, j) || !ch(nx, ny)) continue;
      if(s[i][j] == s[nx][ny] && s[i][j] == '.') continue;
      for(int k = 0; k < h; ++k) now[k] = s[k];
      swap(now[i][j], now[nx][ny]);
      if(search()) return 1;
    }
  return 0;
}

bool ch(int x, int y) {
  return x >= 0 && x < h && y >= 0 && y < w;
}

bool search() {
  for(int i = 0; i < h; ++i) tmp[i] = now[i];
  while(1) {
    for(int i = 0; i < w; ++i) {
      for(int j = h - 1; j >= 0; --j)
        if(tmp[j][i] == '.') {
          for(int k = j - 1; k >= 0; --k)
            if(tmp[k][i] != '.') {
              swap(tmp[j][i], tmp[k][i]);
              break;
            }
        }
    }
    for(int i = 0; i < h; ++i) now[i] = tmp[i];

    bool fin = 1;
    for(int i = 0; i < h; ++i)
      for(int j = 0; j < w; ++j)
        if(now[i][j] != '.') {
          char nowc = now[i][j];
          int nx = i, ny = j;
          while(ch(nx, j) && nowc == now[nx][j]) ++nx;
          while(ch(i, ny) && nowc == now[i][ny]) ++ny;
          if(nx - i >= n) {
            fin = 0;
            for(int k = i; k < nx; ++k) tmp[k][j] = '.';
          }
          if(ny - j >= n) {
            fin = 0;
            for(int k = j; k < ny; ++k) tmp[i][k] = '.';
          }
        }
    if(fin) break;
  }
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j)
      if(now[i][j] != '.') return 0;
  return 1;
}


Measured memory_bytes: 3208
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


N = sorted(il(str))
N[1], N[-1] = N[-1], N[1]
N = "".join(N)
print("YES" if N == "1974" else "NO")


Measured memory_bytes: 3064
import java.util.Scanner;
 
public class Main {
    long count = 0;
 
    public static void main(String[] args) {
        new Main().run();
    }
 
    private void run() {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = scanner.nextInt();
        }
        mergeSort(num, 0, n);
        System.out.println(count);
    }
 
    private void mergeSort(int[] num, int left, int right) {
        if (left + 1 < right) {
            int mid = (left + right) / 2;
            mergeSort(num, left, mid);
            mergeSort(num, mid, right);
            merge(num, left, mid, right);
        }
 
    }
 
    private void merge(int[] num, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;
        int[] L = new int[n1 + 1];
        int[] R = new int[n2 + 1];
        for (int i = 0; i < n1; i++) {
            L[i] = num[left + i];
        }
        for (int i = 0; i < n2; i++) {
            R[i] = num[mid + i];
        }
        L[n1] = Integer.MAX_VALUE;
        R[n2] = Integer.MAX_VALUE;
 
        int l = 0;
        int r = 0;
        for (int k = left; k < right; k++) {
            if (L[l] < R[r]) {
                num[k] = L[l++];
                count += r;
            } else {
                num[k] = R[r++];
            }
        }
 
    }
}

Measured memory_bytes: 101344
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {
    cin.tie(0);

    int a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = 0; i < 2; i++) {
        if (a >= b) {
            ans += a;
            a--;
        } else {
            ans += b;
            b--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<set>
using namespace std;
#define ll long long

int gcd(int a, int b){
    
    if(b==0)
    return a;
    
    return gcd(b, a%b);
    
}
int main(){
string str;
cin>>str;

if(str[2]==str[3] && str[4]==str[5])
    cout<<"Yes";
else
    cout<<"No";

}

Measured memory_bytes: 3596
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
using ll = long long; using ld = long double;
using pii = pair<int,int>; using pil = pair<int,ll>;
using pli = pair<ll,int>; using pll = pair<ll,ll>;
const int MOD = 1000000007, MOD2 = 998244353;
const int INF = 0x3f3f3f3f, INF2 = 0x3f3f3f37;
const ll LINF = 0x3f3f3f3f3f3f3f3f, LINF2 = 0x3f3f3f3f3f3f3f3d;



int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, k; cin >> n >> k;
    double ans = 0, sum = 0;
    vector<double> p(n);
    for (int i = 0; i < n; ++i) cin >> p[i];
    for (int i = 0; i < n; ++i) {
        sum += (p[i] + 1) / 2;
        if (i + 1 >= k) {
            ans = max(ans, sum);
            sum -= (p[i + 1 - k] + 1) / 2;
        }
    }
    cout << fixed << setprecision(9) << ans << '\n';
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    double n, m;
    cin >> n >> m;
    vector<double> a(n);
    double sum = 0;
    rep(i, 0, n){
        cin >> a[i];
        sum += a[i];
    }
    sort(a.rbegin(), a.rend());
    if(a[m-1] < sum/(4*m)){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
    return 0;
}


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

using ll= long long;

int main(){

  ll n,d;
  cin >> n >> d;
  ll ans=0;
  ll x,y;

  for(int i=0;i<n;i++){
    cin >> x >> y;
    if(x*x+y*y<=d*d) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3608
/* Dynamic Programming implementation of LCS problem */
#include<iostream> 
#include<cstring> 
#include<cstdlib> 
using namespace std; 

/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( string X, string Y, int m, int n ) 
{ 
int L[m+1][n+1]; 

/* Following steps build L[m+1][n+1] in bottom up fashion. Note 
	that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
for (int i=0; i<=m; i++) 
{ 
	for (int j=0; j<=n; j++) 
	{ 
	if (i == 0 || j == 0) 
		L[i][j] = 0; 
	else if (X[i-1] == Y[j-1]) 
		L[i][j] = L[i-1][j-1] + 1; 
	else
		L[i][j] = max(L[i-1][j], L[i][j-1]); 
	} 
} 

// Following code is used to print LCS 
int index = L[m][n]; 

// Create a character array to store the lcs string 
char lcs[index+1]; 
lcs[index] = '\0'; // Set the terminating character 

// Start from the right-most-bottom-most corner and 
// one by one store characters in lcs[] 
int i = m, j = n; 
while (i > 0 && j > 0) 
{ 
	// If current character in X[] and Y are same, then 
	// current character is part of LCS 
	if (X[i-1] == Y[j-1]) 
	{ 
		lcs[index-1] = X[i-1]; // Put current character in result 
		i--; j--; index--;	 // reduce values of i, j and index 
	} 

	// If not same, then find the larger of two and 
	// go in the direction of larger value 
	else if (L[i-1][j] > L[i][j-1]) 
		i--; 
	else
		j--; 
} 

// Print the lcs 
cout  << lcs; 
} 

/* Driver program to test above function */
int main() 
{ 
string s,t;cin>>s>>t;

lcs(s, t, s.length(), t.length()); 

return 0; 
} 


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

//値を比較して小さければaにより小さな値を格納する。
template<class T> inline bool chmin(T& a, T b){
    if( a > b ){ 
        a = b;
        return 1;
    }
    return 0;
}

const int INF = INT_MAX;

int main(){
    
    int H,W;
    cin >> H >> W;
    vector<vector<int>> c(10, vector<int>(10,INF));
    
    for(int i = 0 ; i < 10 ; i++) for(int j = 0; j < 10; ++j) cin >> c[i][j];
    
    for(int k = 0; k < 10; k++){
        for(int i =0; i < 10; i++){
            for(int j = 0; j < 10; j++){
                chmin(c[i][j],c[i][k] + c[k][j]);
            }
        }
    }
    
    long long res = 0;
    for(int i = 0; i < H ; i++){
        for(int j = 0; j < W;j++){
            int A;
            cin >> A;
            if(A == -1)continue;
            res += c[A][1];
        }
    }
    cout << res << endl;
}

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

#define D 7368792
int a[D]={0};

int main(){
  int i,t=0,m,n,x;
  do{
    cin >> m >> n;
    if(m==0 && n==0){
      break;
    }else{
      for(x=m;n>0;x++){
        if(a[x]==0){
          for(i=x;i<D;i+=x){
            a[i]=1;
          }
          n--;
        }
      }
      for(i=0;i<D;i++){
        if(t==1 && a[i]==0){
          break;
        }else if(a[i]==1){
          t=1;
        }
      }
      cout << i << endl;
      t=0;
      for(i=0;i<D;i++){
        a[i]=0;
      }
    }
  }while(1);
  return 0;
}

Measured memory_bytes: 31856
using System;

namespace ABC105A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            string[] ss = Console.ReadLine().Split(' ');
            a = int.Parse(ss[0]);
            b = int.Parse(ss[1]);
            if (a % b == 0)
                Console.WriteLine("0");
            else
                Console.WriteLine("1");
            Console.ReadKey();
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  reverse(ALL(a));
  vector<ll> dp(n, INF64);
  rep(i, n) *upper_bound(ALL(dp), a[i]) = a[i];
  cout << distance(dp.begin(), lower_bound(ALL(dp), INF64)) << endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main() {
    int n;
    cin >> n;
    int p;
    int res = 0;
    int now = INF;
    for (int i = 0; i < n; ++i) {
        cin >> p;
        if (chmin(now, p)) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3604
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int m = int.Parse(input[1]);
        bool odd = n % 2 == 1;
        for(int i = 0;i < m; i++)
        {
          int a = i+1;
          int b = n-i;
          if(!odd && (double)a/n > 0.25d) b--;
          Console.WriteLine(a+" "+b);
        }
	}
}

Measured memory_bytes: 37492
#include <iostream>
#include <cmath>

using namespace std;

constexpr double EPS = 0.0000000001;

int main()
{
    double xA, yA, xB, yB, xC, yC, xD, yD;

    while (cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD) {
        double dot = (yA-yB) * (yC-yD) + (xC-xD) * (xA-xB);

        if (abs(dot) < EPS) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

int main() {
    int N; cin >> N;
    int A[2][N];
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < N; j++) cin >> A[i][j];
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int cnt = 0;
        for (int j = 0; j < N; j++) {
            if (i > j) cnt += A[0][j];
            else if (i == j) cnt += A[0][j] + A[1][j];
            else cnt += A[1][j];
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct Node {
   int index, value;
   Node(int index = 0, int value = 0):index(index),value(value){
   }  
};

int calHistrigramArea(const vector<int>& a) {
    deque<Node> dq;
    int ans = 0;
    for (int i = 0; i < a.size(); i++) {
        int e = a[i];
        while (!dq.empty()) {
            if (dq.back().value > e) {
                int v = dq.back().value; dq.pop_back();
                int leftIndex = dq.empty() ? -1 : dq.back().index;
                ans = max(ans, (i - leftIndex - 1) * v);
            } else {
                break;
            }
        }
        dq.push_back(Node(i, e));
    }
    
    int i = a.size();
    while (!dq.empty()) {
        int v = dq.back().value;dq.pop_back();
        int leftIndex = dq.empty() ? -1 : dq.back().index;
        ans = max(ans, (i - leftIndex - 1) * v);
    }
    return ans;
}


int solve(const int n, const int m, const vector<vector<int>>& a) {
    vector<int> dpc(m, 0);
    int best = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 1) {
                dpc[j] = 0;
            }
            else {
                dpc[j]++;
            }
        }
        best = max(best, calHistrigramArea(dpc));
    }
    return best;   
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> matrix(n, vector<int>(m));
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> matrix[i][j];
        }
    }
    
    int ans = solve(n, m, matrix);
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 10484