akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int search(int s[],int key,int head,int tail){
    if(head>tail)return -1;
    
    int mid=(head+tail)/2;
    
    if(s[mid]==key)return mid;
    else if(s[mid]>key)tail=mid-1;
    else if(s[mid]<key)head=mid+1;
    
    return search(s,key,head,tail);
}
int getLB(int s[],int key,int head,int tail){
    if(s[0]>key||tail<0)return 0;
    if(s[tail]<key||head>tail)return tail+1;
    
    int mid=(head+tail)/2;
    
    if(s[mid]<key)head=mid+1;
    else if(s[mid]>=key){
        if(s[mid-1]<key)return mid;
        else tail=mid-1;
    }
        
    return getLB(s,key,head,tail);
}
int insert(int s[],int key,int cnt){
    int d;
    if(cnt==0)d=0;
    else d=getLB(s,key,0,cnt-1);
    
    int i;
    for(i=cnt;i>d;i--)s[i]=s[i-1];
    s[i]=key;
    return 1;
}
int delete(int s[],int key,int cnt){
    int d;
    d=search(s,key,0,cnt-1);
    if(d<0)return -1;
    
    int i;
    for(i=d;i<cnt-1;i++)s[i]=s[i+1];
    return 1;
}
void dump(int s[],int l,int r,int cnt){
    int i;
    i=getLB(s,l,0,cnt-1);

    while(s[i]<=r&&i<cnt)printf("%d\n",s[i++]);
    return;
}
void print(int s[],int cnt){
    printf("cnt=%d,s:",cnt);
    for(int i=0;i<cnt;i++)printf("%d ",s[i]);
    printf("\n");
    return;
}
int main(void){
    int q;
    scanf("%d\n",&q);
    
    int s[q];
    int cnt=0;
    
    int com,x,y;
    while(q--){
        scanf("%d ",&com);
        switch(com){
            case 0:
                //insert
                scanf("%d\n",&x);
//    printf("insert:%d\n",x);
                if(search(s,x,0,cnt-1)==-1){
                    if(insert(s,x,cnt)==1)cnt++;
                }
                printf("%d\n",cnt);
                break;
            case 1:
                //find
                scanf("%d\n",&x);
//    printf("find:%d\n",x);
                if(search(s,x,0,cnt-1)==-1)printf("0\n");
                else printf("1\n");
                break;
            case 2:
                //delete
                scanf("%d\n",&x);
//    printf("delete:%d\n",x);
                if(delete(s,x,cnt)==1)cnt--;
                break;
            case 3:
                //dump
                scanf("%d %d\n",&x,&y);
//    printf("dump:%d %d\n",x,y);
                dump(s,x,y,cnt);
                break;
        }
//        print(s,cnt);
    }
    
    return 0;
}



Measured memory_bytes: 2512
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 75364
import java.util.Scanner;

public class Main{
	
	

	public static void main(String[] args) {
		
	Scanner sc=new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int[] L=new int[M];
    int[] R=new int[M];
    int[] max=new int[M];
    int[] min=new int[M];
    int rmax=N;
    int rmin=0;
    for(int i=0;i<M;i++) {
    	L[i]=sc.nextInt();
    	R[i]=sc.nextInt();
    	if(L[i]>=R[i]) {
    		max[i]=L[i];
    		min[i]=R[i];
    	}else if(L[i]<R[i]){
    		max[i]=R[i];
    		min[i]=L[i];
    	}
    	
    	if(min[i]>rmin) {
    		rmin=min[i];
    	}
    	
    	if(max[i]<rmax) {
    		rmax=max[i];
    	}
    }
    
   
    
    int count=0;
    for(int i=rmin;i<=rmax;i++) {
    	count++;
    }
    
    System.out.println(count);
    
    
    

	
	
	
    

		
	}
	

	
}
	

Measured memory_bytes: 63276
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define in insert
#define er erase
#define fi first
#define se second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define le(x) (int) x.length()
#define rsz resize

using namespace std;
typedef vector <int> vi;
typedef vector <vector <int> > vii;
typedef pair <int, int> pii;
typedef queue <int> qi;
typedef double db;
typedef long long ll;
typedef long double ld;
 
const long double PI=3.141592653589793238462643383279502884;
const long long PRIME1=1e9+787;
 
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll minll(ll a,ll b) {return a<=b?a:b;}
ll maxll(ll a,ll b) {return a>=b?a:b;}

int main () {
    fast;
    ll n;
    vi a;
    cin>>n;
    int count=0;
    for (int i=0; i<n; i++) {
        char c;
        cin>>c;
        if (c=='W') {
            count++;
        } else {
            if (count>0) {
                a.pb(count);
            }
        }
    }
    if (a.size()==0) {
        cout<<0;
        return 0;
    }
    for (int i=a.size()-1; i>-1; i--) {
        if (a[i]<=a.size()-i-1) {
            cout<<a.size()-i-1;
            return 0;
        }
    }
    cout<<a.size();
    return 0;
}
 
 


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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var N = IO.GetInt();
            var ans = 0;
            if (N < 10)
            {
                ans = N;
            }else if (N < 100){
                ans = 9;
            }else if (N < 1000)
            {
                ans= N - 100 + 1 + 9;
            }else if (N < 10000)
            {
                ans = 999 - 100 + 1 + 9;
            }
            else if (N < 100000)
            {
                ans = N - 10000 + 1 + 999 -100 + 1 + 9;
            }
            else
            {
                ans = 99999 - 10000 +1 + 999 -100 +1+ 9;
            }

            Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day [] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
vector <string> v;
void dfs (string str, string t = "", int cnt = 0) {
    if (cnt == 2) {
        v.push_back (t);
        return;
    } else {
        for (int i = 0; i <str.size (); i ++) {
            dfs (str, t + str [i], cnt + 1);
        }
    }
}
int main () {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int a,b;
    while(cin>>a>>b){
        if(a-b>=2)cout<<(a)+(a-1)<<endl;
        else if(a==b){
            if(a==1)cout<<"2"<<endl;
            else cout<<a+b<<endl;
        }
        else if(a-b==1)cout<<a+b<<endl;
        else cout<<b+(b-1)<<endl;
    }
    return 0;
}


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

long long int atack(long long int H, long long int sum){
    if (H == 2 || H == 3){
        sum = 3;
        return sum;
    }
    else if (H == 1) return 1;
    else{
        long long int hp;
        hp = floor(H / 2);
        sum += 2 * atack(hp, sum);
        return sum;
    }
}

int main(){
    long long int H, sum=1;
    cin >> H;
    sum = atack(H, sum);
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return a % 1000000007;
}

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


int main(){
  ll h,w; cin >> h >> w; bool flag = true;
  
  vector<vector<char>> table(h+2,vector<char>(w+2,'.'));
  
  for(ll i=1; i <= h; i++){
    for(ll j=1; j <= w; j++){
      char c; cin >> c; table[i][j] = c;
    }
  }
  
  for(ll i=1; i <= h; i++){
	for(ll j=1; j <= w; j++){
     
      if(table[i][j] == '#' && table[i-1][j] == '.' &&
         table[i][j-1] == '.' && table[i][j+1] == '.' &&
         table[i+1][j] == '.'
      ){
        flag = false;
        break;
      }
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    vector<int> a(300);
    REP(i,3) {
        int x;
        cin >> x;
        x += 100;
        a[x]++;
    }

    REP(i,300) {
        if (a[i] == 1) {
            cout << i-100 << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define ALL(n) begin(n), end(n)

int main()
{
  int N, M, res = 0;
  cin >> N;
  vector<string> s(N);
  rep(i, N) cin >> s.at(i);
  cin >> M;
  vector<string> t(M);
  rep(i, M) cin >> t.at(i);
  vector<int> p(N, 1);
  rep(i, N)
  {
    rep2(j, i + 1, N) if (s.at(j) == s.at(i)) p.at(i)++;
    rep2(j, 0, M) if (t.at(j) == s.at(i)) p.at(i)--;
    res = max(p.at(i), res);
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin>>n;
    vector<pair<int,int> >a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i).first;
        a.at(i).second=i;
    }
    sort(a.begin(),a.end());
    int MAX_index=a.at(n-1).second;
    int ans_index=a.at(n-2).second;
    for(int i=0;i<n;i++){
        if(i==MAX_index){
            cout<<a.at(n-2).first<<endl;
        }
        else{
            cout<<a.at(n-1).first<<endl;
        }
    }







    return 0;
}


Measured memory_bytes: 3200
A = int(input())
B = int(input())
C = int(input())
D = int(input())
P = int(input())

X_price = 0
X_price = A * P

Y_price = 0
Y_price += B

if P > C:
    Y_price += (P - C) * D

print(min(Y_price, X_price))

Measured memory_bytes: 5592
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(k: int, q: int, d: "List[int]", n: "List[int]", x: "List[int]", m: "List[int]"):

    for i in range(q):
        dmod = [v % m[i] for v in d]
        zero = 0
        c, p = divmod(n[i]-1, k)
        last = x[i]
        # print("dmod", dmod)
        # print("c, p", (c, p))
        for j in range(k):
            if j < p:
                last += (c+1)*dmod[j]
                if dmod[j] == 0:
                    zero += c+1
            else:
                last += c*dmod[j]
                if dmod[j] == 0:
                    zero += c
        print(n[i]-1-(zero + (last//m[i] - x[i]//m[i])))

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    k = int(next(tokens))  # type: int
    q = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(k - 1 - 0 + 1)]  # type: "List[int]"
    n = [int()] * (q)  # type: "List[int]"
    x = [int()] * (q)  # type: "List[int]"
    m = [int()] * (q)  # type: "List[int]"
    for i in range(q):
        n[i] = int(next(tokens))
        x[i] = int(next(tokens))
        m[i] = int(next(tokens))
    solve(k, q, d, n, x, m)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63580
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_HUMAN_MAX		100005									// 最大人数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Point[D_HUMAN_MAX];								// ポイント
static int siHCnt;												// 人数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 人数・初期値・ラウンド数 - 取得
	int liIVal, liRCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d%d", &siHCnt, &liIVal, &liRCnt);

	// ポイント - 初期化
	for (i = 1; i <= siHCnt; i++) {
		si1Point[i] = liIVal - liRCnt;
	}

	// 正解者 - 取得
	for (i = 0; i < liRCnt; i++) {
		int liNo;
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d", &liNo);
		si1Point[liNo]++;
	}

	// 出力
	for (i = 1; i <= siHCnt; i++) {
		if (si1Point[i] > 0) {
			sprintf(lc1Buf, "Yes\n");
		}
		else {
			sprintf(lc1Buf, "No\n");
		}
		fOutLine(lc1Buf);
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

int main(){
      int n,m;cin >> n >> m;
      map<int, int> mm;
      int ans = 0;
      for(int i = 0;i < n;i++){
            set<int> no;
            int k;cin >> k;
            for(int j = 0;j < k;j++){
                  int t;cin >> t;
                  if(no.count(t) == 0){
                        mm[t]++;
                        no.insert(t);
                  }
                  if(mm[t] == n)ans++;
            }
      }
      cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void) {
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;
	if (u == s) {
		cout << a - 1 <<" "<< b << endl;
	}
	else {
		cout << a <<" "<< b - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
#define pii pair<int,int>

bool d[31][31][31];
pii edges[31][31];
int N;

class Node{
public:
    int n;
    int prev_n;
    double time;
    int v;

    Node(){}
    Node(int n,int prev_n,double time,int v): n(n), prev_n(prev_n), time(time), v(v){}

    bool operator> (const Node &n) const{
        return time>n.time;
    }

    void addtoq(priority_queue< Node, vector<Node>, greater<Node> > &q){
        //cout<<n<<" : "<<time<<endl;
        if(d[prev_n][n][v]) return;

        d[prev_n][n][v] = true;
        rep(i,N+1){
            if(i==prev_n) continue;
            if(!edges[n][i].first) continue;
            for(int j=-1;j<=1;j++){
                if(v+j>0 && v+j<=edges[n][i].second){
                    Node c=Node(i,n,time+((double)edges[n][i].first/(v+j)),v+j);
                    //cout<<i<<" "<<v+j<<"time"<<time+(double)edges[n][i].first/(v+j)<<endl;;
                    q.push(c);
                }
            }
        }
        //cout<<"!"<<endl;
    }
};

int main(){
    while(1){
        int M,S,G;
        cin>>N>>M>>S>>G;
        if(N==0) break;

        fill_n(*edges, 31*31, pii(0,0));
        rep(i,31)rep(j,31)rep(k,31)d[i][j][k]=false;

        rep(i,M){
            int x,y,d,c;
            cin>>x>>y>>d>>c;
            edges[x][y]=pii(d,c);
            edges[y][x]=pii(d,c);
        }

        priority_queue< Node, vector<Node>, greater<Node> > q;

        rep(i,N+1){
            if(!edges[S][i].first) continue;
            Node c=Node(i, S, edges[S][i].first, 1);
            q.push(c);
        }

        Node u;
        while(!q.empty()){
            u=q.top();q.pop();
            if(u.n==G && u.v==1) break;
            u.addtoq(q);
        }

        if(u.n==G && u.v==1){
            cout<<u.time<<endl;
        }
        else
        {
            cout<<"unreachable"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 21892
import java.util.*;

class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int iin = sc.nextInt();
        int[] iia = new int[iin];
        String[] sirta = new String[100];
        int idxsirta = 0;
        int imax = -1000001;
        int imaxidx = 0;
        int imin = 1000001;
        int iminidx = 0;
        for(int i=0;i<iin;i++){
          iia[i] = sc.nextInt();
          if(imax < iia[i]){
            imax = iia[i];
            imaxidx = i+1;
          }
          if(imin > iia[i]){
            imin = iia[i];
            iminidx = i+1;
          }
        }
        if(imin>=0){
          for(int i=0;i<iin-1;i++){
            if(iia[i]>iia[i+1]){
              iia[i+1] += iia[i];
              sirta[idxsirta] = (i+1) + " " + (i+2);
              idxsirta++;
            }
          }
        }
        else if(imax<0){
          for(int i=iin-1;i>0;i--){
            if(iia[i-1]>iia[i]){
              iia[i-1] += iia[i];
              sirta[idxsirta] = (i+1) + " " + i;
              idxsirta++;
            }
          }          
        }
        else{
          if(imax-(imin*(-1))>=0){
            for(int i=0;i<iin;i++){
              if(iia[i]<0){
                iia[i] += imax;
                sirta[idxsirta] = imaxidx + " " + (i+1);
                idxsirta++;
              }
            }
            for(int i=0;i<iin-1;i++){
              if(iia[i]>iia[i+1]){
                iia[i+1] += iia[i];
                sirta[idxsirta] = (i+1) + " " + (i+2);
                idxsirta++;
              }
            }
          }
          else{
            for(int i=0;i<iin;i++){
              if(iia[i]>0){
                iia[i] += imin;
                sirta[idxsirta] = iminidx + " " + (i+1);
                idxsirta++;
              }
            }
             for(int i=iin-1;i>0;i--){
              if(iia[i-1]>iia[i]){
                iia[i-1] += iia[i];
                sirta[idxsirta] = (i+1) + " " + i;
                idxsirta++;
              }
            }          
          }
        }
        System.out.println(idxsirta);
        for(int i=0;i<idxsirta;i++){
          System.out.println(sirta[i]);
        }
    }
}


Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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


  ll a, b;
  cin >> a >> b;
  a--;
  b--;
  cout << (a + b - 1) / a << endl;





  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int n;

int main() {
    while (cin >> n) {
        cout << fixed << setprecision(9);
        if (n == -1) break;
        double x = 1.0, y = 0.0;
        for (int i = 0; i < n-1; ++i) {
            double abs = sqrt(x*x + y*y);
            double nx = x - y / abs, ny = y + x / abs;
            x = nx, y = ny;
        }
        cout << x << endl;
        cout << y << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1232
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
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; }


int main(){ 
    int a, b, c; cin >> a >> b >> c;
    if(a+b>=c) cout << "Yes" << ln;
    else cout << "No" << ln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP1(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using ll = long long;

int main() {
  string s;
  cin >> s;
  int ans;
  if (s == "SSS") {
    ans = 0;
  } else if (s == "RRR") {
    ans = 3;
  } else if (s.substr(0, 2) == "RR" || s.substr(1, 2) == "RR") {
    ans = 2;
  } else {
    ans = 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;

int main(){
  double R;
  cin>>R;
  cout<<2*R*PI<<endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<pair<ll,int>> p(a);
  rep(i,a) {
    cin >> p.at(i).first;
    p.at(i).second = 0;
  }
  vector<pair<ll,int>> q(b);
  rep(i,b) {
    cin >> q.at(i).first;
    q.at(i).second = 1;
  }
  vector<pair<ll,int>> r(c);
  rep(i,c) {
    cin >> r.at(i).first;
    r.at(i).second = 2;
  }
  ll ans = 0;
  vector<pair<ll, int>> vec;
  rep(i,a) vec.push_back(p[i]);
  rep(i,b) vec.push_back(q[i]);
  rep(i,c) vec.push_back(r[i]);
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  ll cntp = 0;
  ll cntq = 0;
  ll sum = 0;
  rep(i,vec.size()) {
    if(vec[i].second==0) {
      if(cntp>=x) continue;
      else {
        ans += vec[i].first;
        cntp++;
        sum++;
      }
    }
    if(vec[i].second==1) {
      if(cntq>=y) continue;
      else {
        ans += vec[i].first;
        cntq++;
        sum++;
      }
    }
    if(vec[i].second==2) {
      ans += vec[i].first;
      sum++;
    }
    if(sum==x+y) {
      cout << ans << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 15212
def main():
    import itertools
    mod = 10**9+7
    H,W,K = map(int, input().split())
    zero = [0,1]
    dp = [[[0]*W for i in range(W)] for j in range(H+1)]
    for i in range(W):
        dp[0][i][i] = 1
    #print(dp)
    for h in range(1,H+1):
        
        for v in itertools.product(zero, repeat = W-1):
            flag = 0
            for i in range(len(v)-1):
                if v[i] == v[i+1] == 1:
                    flag = 1
            if flag == 0:
                goto = []
                for i in range(W):
                    goto.append(i)
                for i in range(len(v)):
                    if v[i] == 1:
                        tmp = goto[i]
                        goto[i] = goto[i+1]
                        goto[i+1] = tmp
                #print(goto)        
                for i in range(W):
                    for j in range(W):
                        dp[h][i][goto[j]] += dp[h-1][i][j]
                        dp[h][i][goto[j]] %= mod
        #print(dp)
    print(dp[H][0][K-1])
            
    
main()

Measured memory_bytes: 43760
while True:
    a,op,b = map(str,input().split())
    a = int(a)
    b = int(b)
    if op =='?':
        break
    else:
        if op == '+':
            print(a+b)
        elif op == '-':
            print(a-b)
        elif op == '*':
            print(a*b)
        elif op == '/':
            print(a//b)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  ll a[n][n];
  rep(i,n)rep(j,n) R a[i][j];
  ll dp[1<<n];
  mem(dp);
  rep(t,1<<n) {
    rep(i,n) {
      REP(j,i+1,n) {
        if((t&(1<<i))&&(t&(1<<j))) dp[t]+=a[i][j];
      }
    }
  }
  rep(t,1<<n) {
    vector<int> v;
    rep(i,n) {
      if(t&(1<<i)) continue;
      v.pb(i);
    }
    rep(r,1<<v.size()) {
      int e=0;
      rep(i,v.size()) {
        if(r&(1<<i)) e|=1<<v[i];
      }
      dp[t|e]=max(dp[t|e],dp[t]+dp[e]);
    }
  }
  pr(dp[(1<<n)-1]);
}

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


Measured memory_bytes: 768
import java.util.*;
public class Main {
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
	        long array[] = new long[n];
	        long arr[] = new long[2];
	        for (int i = 0; i < n; i++) {
	            array[i] = sc.nextInt();
	        }
	        Arrays.sort(array);
	        int count = 0;
	        for (int i = n - 1; i >= 1; i--) {
	            if (array[i] == array[i - 1]) {
	                arr[count] = array[i];
	                count++;
	                i--;
	            }
	            if (count == 2) {
	                break;
	            }
	        }
	        System.out.println(arr[0] * arr[1]);

	    }
}


Measured memory_bytes: 62784
import java.util.*

fun main(args : Array<String>) {
    val scanner = Scanner(System.`in`)
    println(inOutExec(scanner))
}

fun inOutExec(scanner: Scanner): String {
    val (numOfPref, numOfCity) = readLine()!!.split(" ").map { it.toInt() }

    val citiesIn = mutableListOf<Pair<Int, Int>>()
    repeat(numOfCity) {
        val (pref, year) = readLine()!!.split(" ").map { it.toInt() }
        citiesIn.add(Pair(pref, year))
    }

    val cityCodeMap = citiesIn
            .groupByTo(mutableMapOf()) { it.first }
            .flatMap { entry ->
                entry.value
                        .sortedBy { info -> info.second }
                        .mapIndexed { index, pair ->
                            pair to "%06d%06d".format(pair.first, index + 1) } } // Pair<Pair<Int, Int>, String>
            .toMap()

    return citiesIn.joinToString(separator = "\n", postfix = "\n") { cityCodeMap[it]!! }
}

Measured memory_bytes: 159308
fun main(args: Array<String>) {
    abc000X()
}

fun abc000X() {
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(" ").map(String::toInt)

    var ans = 0
    list.forEach { i ->
        if (i < n - 1) {
            if (list[i - 1] < list[i] && list[i] < list[i + 1]
                || list[i - 1] > list[i] && list[i] > list[i + 1]
            ) {
                ans++
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 36216
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

int dp[2][105], n, a[105];
int main(){
    cin >> n;
    fox1(l, n){
        cin >> a[l];
        dp[0][l]=dp[0][l-1]+a[l];
    }
    fox1(l, n){
        cin >> a[l];
        dp[1][l]=max(dp[1][l-1], dp[0][l])+a[l];
    }
    cout << dp[1][n];
    return 0;
}


Measured memory_bytes: 256
<?php

$nl = explode(' ', trim(fgets(STDIN)));
$n = $nl[0];
$l = $nl[1];

$t = [];
$ts = [];
for($i=1; $i<=$n; $i++){
  $ts[$i] = $l+$i-1;
  $t[$i] = abs($l+$i-1);
}
if (min($ts) == min($t)){
  echo array_sum($ts) - min($t);
} else {
  echo array_sum($ts) + min($t);
}

?>

Measured memory_bytes: 4604
#include<iostream>
#include<string>

using namespace std;
int main(){
  int N;
  cin >> N;
  int A = 100;
  string Ans ("No");
  for(int i = 0; A >= 7; ++i){
    A = N - 7*i;
    if(A % 4 == 0) {
      Ans = "Yes"; 
      break;
    }
  }
   cout << Ans << endl;
    return 0;
}

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


int main(){
        int n,m,i,j,max,sum;
        int a[1000];

        while(1) {
                max=0;
                cin>>n>>m;
                if(n==0 && m==0) {
                        break;
                }

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

                for(i=0; i<n; i++) {
                        for(j=0; j<n; j++) {
                                if(i!=j) {
                                        sum=a[i]+a[j];
                                        if(sum<=m && max<sum) {
                                                max=sum;
                                        }
                                }
                        }
                }
                if(max==0) {
                        cout<<"NONE"<<endl;
                }else{
                        cout << max << endl;
                }
        }
}


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

int n, m;
vector<int> E[100005];
int D[100005];
int P[100005];
int A[100005];
int B[100005];
int C[100005];

void dfs(int x, int p) {
    D[x] = D[p] + 1;
    int now = 1;
    for (int i : E[x]) {
        if (i == p) continue;
        if (now == P[x]) now++;
        P[i] = now++;
        dfs(i, x);
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 1; i < n; i++) {
        cin >> A[i] >> B[i];
        E[A[i]].push_back(B[i]);
        E[B[i]].push_back(A[i]);
    }
    for (int i = 1; i <= n; i++) {
        m = max(m, (int)E[i].size());
    }
    dfs(1, 0);
    cout << m << '\n';
    for (int i = 1; i < n; i++) {
        if (D[A[i]] < D[B[i]]) swap(A[i], B[i]);
        cout << P[A[i]] << '\n';
    }
}

Measured memory_bytes: 9088
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define printjudge(cond) {if(cond) printf("Yes\n"); else printf("No\n");}
#define printans(ans) {printf("%d\n",(ans));}
#define intscan(x) {scanf("%d", &x);}
#define Ntimes(N) for(int i=0; i<N; i++)
#define min(x,y) (((x)<(y)) ? (x) : (y))
#define max(x,y) (((x)>(y)) ? (x) : (y))
typedef int* intarray;
typedef char* string;

int main(){
    int t[5], sum = 0, rem, min_rem = 10;
    Ntimes(5){
        intscan(t[i]);
        sum += ((t[i]-1)/10+1)*10;
        rem = (t[i]-1)%10 + 1;
        min_rem = min(rem, min_rem);
    }
    printans(sum-10+min_rem);
    return 0;
}

Measured memory_bytes: 128
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # print(divisors)
    return divisors

ans = 0

for i in range(1, n+1, 2):
    if len(make_divisors(i)) == 8:
        ans += 1

print(ans)


Measured memory_bytes: 38392
n,p = tuple(map(int,input().split()))
s = input()
modlist = [0]*p
modlist[0] = 1
if p!= 2 and p != 5:
    mod = 0
    pwrmod = 1
    for i in s[::-1]:
        mod = (mod + pwrmod * int(i)) % p
        pwrmod = (pwrmod * 10) % p
        modlist[mod] += 1
    ans = 0
    for i in modlist:
        ans += (i * (i-1)) // 2

    print(ans)
else:
    ans = 0
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i+1
    print(ans)


Measured memory_bytes: 3500
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin>>n;
    vector<int>a(n);
    vector<int>b(n);
    vector<int>c(n);
    for(int i=0;i<n;i++){
        int x,y,z;
        cin>>x>>y>>z;
        a.at(i)=x;
        b.at(i)=y;
        c.at(i)=z;
    }
    vector<int>dpa(n,0);
    vector<int>dpb(n,0);
    vector<int>dpc(n,0);
    dpa.at(0)=a.at(0);
    dpb.at(0)=b.at(0);
    dpc.at(0)=c.at(0);

    for(int i=1;i<n;i++){
        dpa.at(i)=max(dpb.at(i-1)+a.at(i),dpc.at(i-1)+a.at(i));
        dpb.at(i)=max(dpc.at(i-1)+b.at(i),dpa.at(i-1)+b.at(i));
        dpc.at(i)=max(dpa.at(i-1)+c.at(i),dpb.at(i-1)+c.at(i));
    }
    cout<<max(max(dpa.at(n-1),dpb.at(n-1)),dpc.at(n-1))<<endl;






    return 0;
}


Measured memory_bytes: 2560
n = int(input())
a = list(map(int,input().split()))
ans = 'APPROVED'
for i in range(n):
    if a[i]%2 == 0 and not (a[i]%3 == 0 or a[i]%5 == 0):
        ans = 'DENIED'
        break
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

int main() {
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll>a(n);
    vector<ll>b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    vector<ll>s(n+1);
    rep(i,n) s[i+1] = s[i] + a[i];
    vector<ll>sb(m+1);
    rep(i,m) sb[i+1] = sb[i] + b[i];
    ll ans = 0;
    rep(i,n+1) {
        ll lim = k - s[i];
        ll l = -1;
        ll r = sb.size();
        while(r-l > 1) {
            ll mid = (l+r)/2;
            if(sb[mid] > lim) r = mid;
            else l = mid;        
        } 
        if(lim>=0)ans = max(ans,i+l);
    }

    cout << ans << endl;
}

Measured memory_bytes: 9552
/*  ***  In The Name of God ... ***  */
#include <bits/stdc++.h>

using namespace std ;
 
typedef long long ll ;
typedef long double ld ;


#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 100 + 10 ;

int n ; 
multiset < int > st , cur ; 

void fail ( ) {
	cout << "Impossible\n" ;
	exit ( 0 ) ; 
}

void do_remove ( int x ) {
	if ( st . find ( x ) == st . end ( ) )
		fail ( ) ;
	cur . insert ( x ) ; 
	st . erase ( st . find ( x ) ) ; 
}

int32_t main()                     
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	for ( int j = 0 ; j < n ; ++ j ) {
		int x ;
		cin >> x ;
		st . insert ( x ) ; 
	}
	int k = *st . rbegin ( ) ;
	if ( k & 1 ) {
		int c = ( k + 1 ) >> 1 ;
		for ( int d = c ; d <= k ; ++ d ) {
			do_remove ( d ) ;
			do_remove ( d ) ; 
		}
	}
	else {
		do_remove ( k >> 1 ) ;
		for ( int c = ( k >> 1 ) + 1 ; c <= k ; ++ c ) {
			do_remove ( c ) ;
			do_remove ( c ) ; 
		}
	}
	while ( !st . empty ( ) ) {
		int x = *st . begin ( ) ;
		if ( cur . find ( x - 1 ) == cur . end ( ) )
			fail ( ) ;
		cur . insert ( x ) ;
		st . erase ( st . find ( x ) ) ; 
	}
	cout << "Possible\n" ; 
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void Solve(){
	int a,b;
	while(true){
		cin >> a >> b;
		if(a==0&&b==0) break;
		
		int c=b-a;
		int x=c/1000;
		c-=1000*x;
		int y=c/500;
		c-=500*y;
		int z=c/100;
		c-=100*z;
	
		cout << z << ' ' << y << ' ' << x << endl;
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

Measured memory_bytes: 1196
<?php

$n = trim(fgets(STDIN));
$s = str_split(trim(fgets(STDIN)));

if($n == 1) {
    echo 1;
} else {
    $ans = $n;
    $now = $s[0];
    for ($i = 1; $i < $n; $i++) {
         if($s[$i] == $now) {
             $ans--;
         }
         $now = $s[$i];
    }
    
    echo $ans;
}


Measured memory_bytes: 10872
#include <stdio.h>
#include <math.h>

int main(void)
{
    double a, b, C;
    double c;
    double S, L, h;

    scanf("%lf %lf %lf", &a, &b, &C);
    C = C / 360 * 2 * M_PI; // to radian

    S = a * b * sin(C) / 2;
    printf("%f\n", S);

    c = sqrt(a * a + b * b - 2 * a * b * cos(C));
    L = a + b + c;
    printf("%f\n", L);

    h = b * sin(C);
    printf("%f\n", h);

    return (0);
}

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

int main(){
  vector<int> abcde(5);
  int k;
  for(int i = 0;i < 5;i++) cin >> abcde.at(i);
  cin >> k;
  
  for(int i = 0;i < 5;i++){
    for(int j = i + 1;j < 5;j++){
      if(k < abcde.at(j) - abcde.at(i)){
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;
  
  return 0;
}

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

bool solve() {
    int N;
    cin >> N;
    for ( int i = 1; i < 10; i++ ) {
        if ( N % i == 0 && N / i < 10) return true;
    }
    return false;
}

int main() {
    string ans = solve() ? "Yes" : "No";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import static java.lang.Math.*;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		DecimalFormat df1 = new DecimalFormat("########.000000");
		while(sc.hasNext()){
			int x = sc.nextInt();
			int h = sc.nextInt();
			if((x == 0 && h == 0) || (x > 100 || h > 100)) break;
			double sh = sqrt(pow(0.5*x,2) + pow(h,2));
			double S = pow(x,2) + 4*(0.5*x*sh);
			System.out.println(df1.format(S));
		}
	}
}

Measured memory_bytes: 26344
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int n;

ll mem[105][10][10][10];
string s = " AGCT";
vector<string> m;

ll dp(int i, int p, int q, int r) {
    if(i==n) return 1;
    if(~mem[i][p][q][r]) return mem[i][p][q][r];
    
    mem[i][p][q][r] = 0;

    string t = "", u;
    t = t + s[p] + s[q] + s[r] ;
    for(int j = 1; j < 5; j++) {
        u = t + s[j];
        bool f = true;
        for(int k = 0; k < 3; k++) {
            swap(u[k], u[k+1]);
            f &= (u.find("AGC") == string::npos);
            swap(u[k], u[k+1]);
        }
        if(f && u.find("AGC") == string::npos)
            mem[i][p][q][r] += dp(i+1, q, r, j);
    }
    
    return mem[i][p][q][r] %= SMOD;
}

signed main() {

    cin >> n;

    memset(mem,-1,sizeof(mem));
    
    cout << dp(0, 0, 0, 0) << endl;

  
    return 0;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;

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

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

/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  int k;
  cin >> k;
  int64_t sum = 0;
  rep(i, k){
    rep(j, k){
      rep(m, k){
        int s = gcd(i+1, j+1);
        s = gcd(s, m+1);
        sum += s;
      }
    }
  }
  cout << sum << endl;
  /*int n;
  cin >> n;
  vector<int> A(n);
  rep(i, n){
    if((i+1)%15==0) A[i]=0;
    else if((i+1)%5==0) A[i] = 0;
    else if((i+1)%3==0) A[i] = 0;
    else A[i] = i+1;
  }
  int64_t sum=0;
  rep(i, n) sum += A[i];
  cout << sum << endl;*/

}



Measured memory_bytes: 3592