akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)

int N;

std::vector<int> div(int n){
	std::vector<int> v;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			v.push_back(i);
			if(i*i!=n){
				v.push_back(n/i);
			}
		}
	}
	sort(v.begin(),v.end());
	return v;
}

signed main(){
	cin>>N;
	int sum=0;
	vector<int> v=div(N);
	for(int i=0;i<v.size();i++){
		int t=N/v[i]-1;
		if(t<=0)continue;
		if(N/t==N%t){
			sum+=t;
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 384
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

A, B, C, D = gets_i_list
E = C.lcm(D)

total = 0
total += (B / C) - ((A-1) / C)
total += (B / D) - ((A-1) / D)
total -= (B / E) - ((A-1) / E)

puts B - A + 1 - total


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll a,b;
  cin >> a >> b;
  cout << a*b << endl;
return 0;}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
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; }
const ll MOD = 1e9+7;

ll DP[1100][11000];

int main(){
    ll H, N;
    cin >> H >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    REP(i,N){
        ll a, b;
        cin >> a >> b;
        A[i] = a;
        B[i] = b;
    }

    REP(i,N+1)
        REP(j, H+1)
            DP[i][j] = 1e17;
        
    DP[0][0] = 0;
    REP(i,N){
        ll a = A[i];
        ll b = B[i];
        REP(j,H+1){
            chmin(DP[i+1][j], DP[i][j]);

            ll x = min(H, j+a);
            chmin(DP[i+1][x], DP[i][j] + b);
            chmin(DP[i][x], DP[i][j] + b);
        }
    }

    ll ans = 0;
    ans = DP[N][H];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 88192
#import time
from itertools import dropwhile, takewhile
def main():
    N, M = list(map(int, input().split()))
    lis = [list(map(int, input().split())) for _ in range(M)]
    #print(lis)
    edge = [[] for _ in range(N+1)]
    #print(edge)
    for a,b in lis:
        edge[a].append(b)
        edge[b].append(a)
        #print(edge)
    ans = [0] * (N+1)
    visited = {0}
    stack = [1]
    for i in stack:
        for j in edge[i]:
            if j in visited:
                continue
            stack.append(j)
            #print(stack)
            visited.add(j)
            #print(visited)
            ans[j]=i
    print("Yes")
    for k in ans[2:]:
        print(k)


if __name__ == '__main__':
    #start = time.time()
    main()
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

Measured memory_bytes: 64004
n = int(raw_input())
nums = map(int, raw_input().split())

pos = {}
for i in nums:
    if not i-1 in pos:
        pos[i-1] = 0
    if not i in pos:
        pos[i] = 0
    if not i+1 in pos:
        pos[i+1] = 0

    pos[i-1] += 1
    pos[i] += 1
    pos[i+1] += 1

print max(pos.values())


Measured memory_bytes: 53360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll dp[100],n,a[100],i,j;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a[i];
    dp[i]=0;
  }
  dp[0]=1000;
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      dp[j]=max(dp[j],dp[i]/a[i]*a[j]+dp[i]%a[i]);
      dp[j]=max(dp[j],dp[i]);
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

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

int main(){
    string S;
    cin >> S;
    //間それぞれに+が入るかをビット全探索
    ll totalSum = 0;
    for(int tmp = 0; tmp < (1 << (S.length() - 1)); tmp++){
        bitset<9> s(tmp);
        string sum = {S.at(0)};
        for(int i = 0; i < (S.length() - 1); i++){
            if(s.test(i)){
                sum.push_back('+');
            }
            sum.push_back(S.at(i + 1));
        }
        //文字列から足し算
        string tmp1 = "";
        for(int i = 0; i < sum.length(); i++){
            if(sum.at(i) == '+'){
                ll num = stoll(tmp1);
                totalSum += num;
                tmp1 = "";
            }else{
                tmp1.push_back(sum.at(i));
            }
        }
        ll num = stoll(tmp1);
        totalSum += num;
    }
    cout << totalSum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // sqrt()

#define MAX_N 100
#define max(a, b) ((a) > (b) ? (a) : (b))

int dx[MAX_N][MAX_N / 2];
int dp[MAX_N][MAX_N / 2];
int data[2500];

int
main(int argc, char **argv)
{
	int n;
	int i, j, k;

	k = 0;
	while (scanf("%d,", &data[k++]) != EOF)
		;

	n = sqrt(k) - 1;
	k = 0;
	for (i = 0; i <= n; ++i)
	{
		for (j = 0; j <= i; ++j)
			dx[i][j] = data[k++];
	}

	for (i = n + 1; i < n + n + 1; ++i)
	{
		for (j = 0; j < n + n + 1 - i; ++j)
			dx[i][j] = data[k++];
	}

	dp[0][0] = dx[0][0];
	for (i = 0; i < n; ++i)
	{
		dp[i + 1][0] = dp[i][0] + dx[i + 1][0];
		for (j = 0; j < i; ++j)
			dp[i + 1][j + 1] = max(dp[i][j], dp[i][j + 1]) + dx[i + 1][j + 1];

		dp[i + 1][i + 1] = dp[i][i] + dx[i + 1][i + 1];
	}

	for (i = n; i < n + n; ++i)
	{
		for (j = 0; j < n + n - i; ++j)
			dp[i + 1][j] = max(dp[i][j], dp[i][j + 1]) + dx[i + 1][j];
	}

	printf("%d\n",dp[n + n][0]);
	return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin >>a.at(i);
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int d=0;
  for(int i=0;i<n;i++){
    if(i%2==0)d+=a.at(i);
    else d-=a.at(i);
  }
  cout << d <<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void call(int n){
   for(int i = 1; i <= n; i++){
      int x = i;
      if(x % 3 == 0){
         cout << " " << i;
      }
      else{
         for(;x;){
            if(x % 10 == 3){
               cout << " " << i;
               break;
            }
            x /= 10;
         }
      }
   }

   cout << endl;

}

int main(){

   int n;

   cin >> n;

   call(n);

   return 0;
}


Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){ 
    int a,b;
    string c;
    cin >> a >> c >> b;
    if(c=="+"){
        cout << a+b;
    }
    else cout << a-b <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};

int32_t main(){
    string s;
    cin >> s;
    int n=s.length();

    int cnt_g=1, cnt_p=0, pnt=0;
    FOR(i, 1, n){
        if(s[i]=='g'){
            if(cnt_p<cnt_g){
                cnt_p++;
                pnt++;
            }
            else{
                cnt_g++;
            }
        }
        else{
            if(cnt_p>=cnt_g){
                cnt_g++;
                pnt--;
            }
            else{
                cnt_p++;
            }
        }
    }

    cout << pnt << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, cnt = 0;
  cin >> n;
  if (n & 1){
    return puts("0"), 0;
  }
  for (long long i = 10; n/i >= 1; i*=5){
    cnt += n/i;
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;
using System.Text;
using static System.Math;

class MainClass
{

    public static void Main(string[] args)
    {
        var S = LnStr();
        var T = LnStr();
        if (T.Remove(T.Length - 1, 1) == S)
        {
            print("Yes");
        }
        else
        {
            print("No");
        }
    }

public static long SumAtoB(long a,long b){var length = b - a + 1;return (a + b) * (length / 2) + (length % 2 == 1 ? (a + b) / 2 : 0);}
public static long PowLite(long n, long p, int mod = (int)1e9 + 7){long ans = 1;long now = n;for (; p > 0; p >>= 1){if ((p & 1) == 1){ans *= now;ans %= mod;}now *= now;now %= mod;}return ans;}
public static void print(object obj) { Console.WriteLine(obj); }
public static long Gcd(long a, long b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
public static int Gcd(int a, int b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
public static int[] LnInts() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new int[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]); return ins; }
public static int LnInt() { var vs = Console.ReadLine().Trim(); return int.Parse(vs); }
public static long[] LnLngs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new long[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = long.Parse(vs[i]); return ins; }
public static long LnLng() { var vs = Console.ReadLine().Trim(); return long.Parse(vs); }
public static string[] LnStrs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); return vs; }
public static string LnStr() { var vs = Console.ReadLine().Trim(); return vs; }
public static List<T[]> AllPermutation<T>(params T[] array) where T : IComparable{var a = new List<T>(array).ToArray();var res = new List<T[]>();res.Add(new List<T>(a).ToArray());var n = a.Length;var next = true;while (next){next = false;int i;for (i = n - 2; i >= 0; i--){if (a[i].CompareTo(a[i + 1]) < 0) break;}if (i < 0) break;var j = n;do{j--;} while (a[i].CompareTo(a[j]) > 0);if (a[i].CompareTo(a[j]) < 0){var tmp = a[i];a[i] = a[j];a[j] = tmp;Array.Reverse(a, i + 1, n - i - 1);res.Add(new List<T>(a).ToArray());next = true;}}return res;}}


Measured memory_bytes: 25804
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

K = I()
S = str(input())

if len(S) <= K:
    print(S)
else:
    print(S[:K]+'...')

Measured memory_bytes: 65268
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define CL(a,x) memset(a, x, sizeof(a))
#define MP make_pair
#define PB push_back
#define PII pair<int, int>
typedef long long LL;
const LL P = 998244353;
const int N = 1005;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,a[N][N];

void solve(int l,int r,int num){
	if(l==r) return;
	int mid = l+r>>1;
	if(mid>=l) solve(l,mid,num+1);
	if(mid<r) solve(mid+1,r,num+1);
	rep(i,l,mid)rep(j,mid+1,r)a[i][j]=num;
}

int main(){
	//freopen("test.in","r",stdin);
	cin>>n;
	solve(1,n,1);
	rep(i,1,n){
		rep(j,i+1,n)printf("%d ",a[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<algorithm>
#define L long long
#include<string.h>
#include <math.h>
long long  array1[100002];
using namespace std;
int n;
long long a,b;
int judge(int x)
{
    long long sum=0;
      for(int i=0;i<n;i++)
      {
          long long num=array1[i]-x*b;
          if(num>0)
          {
              sum+= ceil((num*1.0)/(a-b));
              if(sum>x||sum<0)
                return 0;
          }
      }
      return 1;
}

int main()
{   int i;
   cin>>n>>a>>b;
        for(i=0;i<n;i++)
        {
        cin>>array1[i];
        }
            sort(array1,array1+n);
        long long l=0,r=array1[n-1];
         while(l<r)
         {
             long long mind=(l+r)>>1;
             if(judge(mind)==1)  r=mind;
             else
                 l=mind+1;
         }
         cout<<r<<endl;


       return 0;
}


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



int main(){
    int H, W; cin >> H >> W;
    int BlockNum = 0;
    int maze[H][W];
    string X;
    for(int i = 0; i < H; i++){
        cin >> X;
        for(int j = 0; j < W; j++){
            if(X[j] == '#'){
                BlockNum += 1;
                maze[i][j] = 0;
            }
            else if(X[j] == '.'){
                maze[i][j] = 1;
            }
        }
    }

    int sr = 0, sc = 0, gr = H-1, gc = W-1;
    queue<int> QR, QC, Qc;
    QR.push(sr); QC.push(sc); Qc.push(0);
    int stepR[4] = {1, 0, -1, 0};
    int stepC[4] = {0, 1, 0, -1};
    int cnt = 0;
    bool flag = false;
    while(!QR.empty()){
        int r = QR.front(), c = QC.front();
        maze[r][c] = 0;
        cnt = Qc.front();
        QR.pop(); QC.pop(); Qc.pop();
        for(int i = 0; i < 4; i++){
            int nextR = r + stepR[i];
            int nextC = c + stepC[i];
            if(nextR == H-1 && nextC == W-1){
                cnt += 1;
                while(!QR.empty()) { QR.pop(); QC.pop(); Qc.pop(); }
                flag = true;
                break;
            }
            if(0 <= nextR && nextR < H && 0 <= nextC && nextC < W){ //マスの中に収まってるなら
                if(maze[nextR][nextC] == 1){ //未探索なら
                    QR.push(nextR); QC.push(nextC); Qc.push(cnt+1);
                    maze[nextR][nextC] = 0;
                }
            }
        }
    }
    int ans = H * W - (cnt+1) - BlockNum;
    if(flag) cout << ans << endl;
    else cout << -1 << endl;
}


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

int main()
{
  string s;
  cin >> s;
  int num = 0;
  for(int i = 0; i < 4; i++){
    if(s[i] == '+'){
      num++;
    }
    else{
      num--;
    }
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
vector<int> vertexs[200];
int main() {
	int n, m;
	cin >> n >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		vertexs[a].push_back(b);
		vertexs[b].push_back(a);
	}
	long long ans = 0;
	for (int i = 1;i <= n;++i) {
		for (int q = 0;q < vertexs[i].size();++q) {
			int visited[200] = {};
			visited[i] = true;
			queue<int> geko;
			for (int t = 0;t < vertexs[i].size();++t) {
				if (t != q) {
					visited[vertexs[i][t]] = true;
					geko.push(vertexs[i][t]);
				}
			}
			while (geko.empty() == false) {
				int now = geko.front();
				geko.pop();
				for (int t = 0;t < vertexs[now].size();++t) {
					if (visited[vertexs[now][t]] == false) {
						visited[vertexs[now][t]] = true;
						geko.push(vertexs[now][t]);
					}
				}
			}
			for (int t = 1;t <= n;++t) {
				if (visited[t] == false) {
					ans++;
					break;
				}
			}
		}
	}
	cout << ans/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int H, W, i, j;
	
	while(1){
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0){
			break;
		}
		for(i = 0;i < H;i++){
			for(j = 0;j < W;j++){
				if((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define D(...) fprintf(stderr,__VA_ARGS__)
//#define int long long
#define LL long long
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef pair<int,int>PII;typedef vector<int>VI;typedef vector<PII>VII;
template<typename T>void rd(T&x){int f=0,c;while(!isdigit(c=getchar()))f^=!(c^45);x=(c&15);while(isdigit(c=getchar()))x=x*10+(c&15);if(f)x=-x;}
template<typename T>void pt(T x,int c=-1){if(x<0)putchar('-'),x=-x;if(x>9)pt(x/10);putchar(x%10+48);if(c!=-1)putchar(c);}
const int N=1000005;
const int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int n,m,k,sx,sy,tx,ty,q[N][2],dis[N];
string s[N];
int zip(int x,int y){return(x-1)*m+y;}
void bfs(){
	int he=0,ta=1;
	q[1][0]=sx,q[1][1]=sy,dis[zip(sx,sy)]=0;
	while(he!=ta){
		int x=q[++he][0],y=q[he][1];
		if(x==tx&&y==ty){
			printf("%d\n",dis[zip(x,y)]);
			exit(0);
		}
		rep(j,0,3){
			int nx=x,ny=y;
			rep(i,1,k){
				nx+=dx[j],ny+=dy[j];
				if(nx<1||ny<1||nx>n||ny>m||s[nx][ny]=='@')break;
				if(dis[zip(nx,ny)]<=dis[zip(x,y)])break;
				if(dis[zip(nx,ny)]>dis[zip(x,y)]+1){
					dis[zip(nx,ny)]=dis[zip(x,y)]+1;
					q[++ta][0]=nx,q[ta][1]=ny;
				}
			}
		}
	}
}
signed main(){
	memset(dis,63,sizeof(dis));
	rd(n),rd(m),rd(k),rd(sx),rd(sy),rd(tx),rd(ty);
	rep(i,1,n)cin>>s[i],s[i]=" "+s[i];
	bfs();
	puts("-1");
	return 0;
}

Measured memory_bytes: 44324
#include <stdio.h>
int main(){
  
    int A,B,K,i,a,b;
  
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &K);
  
    i = 0;
    while(i < K){
      if(A % 2 == 1){
        A -= 1;
      }
      a = A / 2;
      A = a;
      B += a;
      ++i;
      if(i >= K){
        break;
      }
      if(B % 2 == 1){
        B -= 1;
      }
      b = B / 2;
      A += b;
      B = b;
      ++i;
    }
  
    printf("%d %d \n", A, B);
  
    return 0;
}
        


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

int main(){
  while(1){
  int n;
  double x=1,y=1,dis,tx,ty;
  cin>>n;
  if(n==-1)break;
  for(int i=0;i<n-2;i++){
    dis=sqrt(x*x+y*y);
    if(x>0 && y>0) tx=-y,ty=x;
    else if(x<0 && y>0) tx=-y,ty=x;
    else if(x<0 && y<0) tx=-y,ty=x;
    else tx=-y,ty=x;
    tx/=dis,ty/=dis;
    x+=tx,y+=ty;
  }
  printf("%.2f\n%.2f\n",x,y);
  }
  
  return 0;
}

Measured memory_bytes: 1196
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;
int a[999],i;main(){int n,j;
	for(scanf("%d",&n);i<n;i++)scanf("%d",a+i);
	sort(a,a+n,greater<int>());
	long long r=1;
	for(i=0;i<n&&(j=a[i]-i/4)>0;i++)r+=j;
	i=!printf("%lld\n",r);
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n ;
	cin >> n ;
	vector<int> v(n + 1) ;
	for(int i = 1; i <= n; i++){
        int x ;
        cin >> x ;
        v[x] = i ;
	}
	for(int i = 1; i <= n; i++){
        cout << v[i] << ' ' ;
	}
	return 0 ;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using pil = pair<int, long long>;
using pll = pair<long long, long long>;

long long largestRectangleFromHist(vector<pll> &v) {
  v.push_back(make_pair(0, 0));
  int n = v.size();
  long long ans = 0;
  vector<pil> stack;
  for (int i = 0; i < n; i++) {
    if (stack.size() == 0) {
      stack.push_back(make_pair(i, v[i].second));
      ans = max(ans, v[i].first);
    } else {
      if (stack[stack.size() - 1].second <= v[i].second) {
        ans = max(ans, v[i].first);
        stack.push_back(make_pair(i, v[i].second));
      } else if (v[i].second < stack[stack.size() - 1].second &&
                 stack[stack.size() - 1].second <= v[i].first) {
        int j = i;
        while (stack.size() > 0 &&
               stack[stack.size() - 1].second > v[i].second) {
          j = min(j, stack[stack.size() - 1].first);
          ans = max(ans, (i - stack[stack.size() - 1].first + 1) *
                             stack[stack.size() - 1].second);
          stack.pop_back();
        }
        stack.push_back(make_pair(j, v[i].second));
      } else {
        int j = i;
        while (stack.size() > 0 &&
               stack[stack.size() - 1].second > v[i].second) {
          j = min(j, stack[stack.size() - 1].first);
          ans = max(ans, (i - stack[stack.size() - 1].first) *
                             stack[stack.size() - 1].second);
          stack.pop_back();
        }
        stack.push_back(make_pair(j, v[i].second));
      }
    }
  }
  return ans;
}

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> mp(h);
  for (int i = 0; i < h; i++)
    cin >> mp[i];

  bool ng[2005][2005] = {0}, ng2[2005][2005] = {0};
  for (int i = 0; i < h - 1; i++)
    for (int j = 0; j < w - 1; j++) {
      int sum = 0;
      if (mp[i][j] == '#')
        sum++;
      if (mp[i + 1][j] == '#')
        sum++;
      if (mp[i][j + 1] == '#')
        sum++;
      if (mp[i + 1][j + 1] == '#')
        sum++;
      if (sum % 2 == 1)
        ng[i + 1][j + 1] = ng2[i + 1][j + 1] = true;
    }
  vector<vector<int>> table(h), table2;
  for (int i = 0; i < h; i++) {
    table[i].resize(w);
    for (int j = 0; j < w; j++)
      table[i][j] = 1;
  }
  table2 = table;
  for (int i = 1; i < h; i++)
    for (int j = 0; j < w; j++) {
      if (!(ng[i][j] && ng[i][j + 1]) && !ng[i][j + 1]) {
        table[i][j] = table[i - 1][j] + 1;
      }
      if (!(ng2[i][j] && ng2[i][j + 1])) {
        table2[i][j] = table2[i - 1][j] + 1;
      }
    }
  long long ans = 0;
  for (int i = 0; i < h; i++) {
    vector<pll> v;
    for (int j = 0; j < w; j++) {
      v.push_back(make_pair(table2[i][j], table[i][j]));
    }
    ans = max(ans, largestRectangleFromHist(v));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 43648
import math
a=input().split(" ")
N=int(a[0])
D=int(a[1])
vector=[]
for p in range(0,N):
    v=input().split(" ")
    vec=[]
    for q in range(0,D):
        vec.append(int(v[q]))
    vector.append(vec)
count=0
for r in range(0,N):
    for s in range(r+1,N):
        distance2=0
        for t in range(0,D):
            distance2+=(vector[r][t]-vector[s][t])**2
        if math.sqrt(distance2)%1==0:
            count+=1
print(count)

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


using namespace std;
long long n;
long long k;
vector<long long> vec;

long long meme[100007];

long long solve(long long index){

    if(index==n-1){
        return 0;
    }
    
    if(meme[index]!=-1){
        return meme[index];
    }
    
    long long ret = 10000000000000000;
    long long sol = 10000000000000000;
    for(long long i = 1 ;i<=k ; i++){
        if(index+i<n){
            ret = abs (vec[index]- vec[index+i]) + solve(index+i); 
        }
        sol = min(sol,ret);
    }

    return meme[index] = sol;
}

int main(){
    cin>>n;
    cin>>k;
    memset(meme,-1,sizeof(meme));
    long long num;
    for(long long i = 0 ; i<n ; i++){
        cin>>num;
        vec.push_back(num);
    }
    cout<<solve(0)<<endl;
    return 0;
}

Measured memory_bytes: 11084
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 200003

ll modpow(ll a,ll n,ll mod){
  ll res=1;
  while(n>0){
    if(n&1){       //nのbitと...00001を比較  nが2で割り切れるならtrue
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

int main(){
  ll N;
  cin>>N;
  ll ans=modpow(10,N,MOD);
  ans+=(MOD-modpow(9,N,MOD))*2;
  ans%=MOD;
  ans+=modpow(8,N,MOD);
  ans%=MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <stack>
#include <utility>

using namespace std;

void Output(stack<pair<int,int> > lake)
{
	stack<pair<int,int> > res_lake;
	int lake_sum = 0;
	int n = lake.size();
	for(int i=0; i<n; i++){
		lake_sum += lake.top().first;
		res_lake.push(lake.top());
		lake.pop();
	}
	
	cout << lake_sum << endl; 
	cout << n;
	for(int i=0; i<n; i++){
		cout << " "<< res_lake.top().first;
		res_lake.pop();
	}
	cout << endl;
	return;
}

void MakeLake(char input,int i,stack<pair<int,int> > &lake,stack<int> &downlink)
{
	if(input == '\\'){
		downlink.push(i);
	}else if(input == '/'){
		if(downlink.empty())return;
		int lake_size = i - downlink.top();
		while(lake.empty() == false && lake.top().second > downlink.top()){
			lake_size += lake.top().first;
			lake.pop();
		}
		lake.push(make_pair(lake_size,downlink.top()));
		downlink.pop();
	}
	return;
}

int main()
{
	stack<int> downlink;
	
	int i = 0;
	char input;
	stack<pair<int,int> > lake;
	while(1){
		i++;
		cin >> input;
		if(!cin)break;
		MakeLake(input,i,lake,downlink);
	}
	Output(lake);
}

Measured memory_bytes: 1288
#include <stdio.h>

int main(){

	int a = 0, n = 0, b = 0,i,t=0;

	while(1){
		scanf("%d", &n);
		if (n == 0){ break; }

	for (i = 0; i < n; i++){
		scanf("%d", &a);
		if (a>0){ b++; }
		if (a > 1){ t++; }
	}

	if (t == 0){
		printf("NA\n");
	}
	else{
		printf("%d\n", b + 1);
	}b = 0; a = 0; n = 0, t = 0;
}
	return 0;
}

Measured memory_bytes: 1040
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let c: usize = read();
    let mut tt: Vec<Vec<i64>> = vec![vec![0; 100_001]; c + 1];
    let mut maxv = 0;

    for _ in 0..n {
        let s: usize = read();
        let t: usize = read();
        let c: usize = read();
        tt[c][s] += 1;
        tt[c][t] -= 1;
    }

    let mut current = 0;
    for i in 0..100_001 {
        let mut minus_stack = 0;
        for j in 1..c + 1 {
            if tt[j][i] == 1 {
                current += 1;
            }

            if tt[j][i] == -1 {
                minus_stack += 1;
            }
        }
        if current > maxv {
            maxv = current;
        }
        current -= minus_stack;
    }
    println!("{}", maxv);
}


Measured memory_bytes: 35196
n=gets.to_i
t=[nil]
n.times do
  t << []
end
(n-1).times do |i|
  a,b,c=gets.split.map(&:to_i)
  t[a] << [b,c]
  t[b] << [a,c]
end
q,k=gets.split.map(&:to_i)
s=[[k,0]]
d=[nil]*(n+1)
d[k]=0
n-=1
while n>0
  z=[]
  s.each do |sk,sc|
    t[sk].each do |tt,tc|
      if d[tt]==nil
        z << [tt,sc+tc]
        d[tt]=d[sk]+tc
        n-=1
      end
    end
  end
  s=z.dup
end
q.times do
  x,y=gets.split.map(&:to_i)
  puts d[x]+d[y]
end


Measured memory_bytes: 45052
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
/*int main()
{
	int n; cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
//	for(int i=0;i<n;i++) cout<<a[i];
	int sum=0;
	for(int i=n-1;i>1;i--)
	{
		for(int j=i-1;j>0;j--)
		{
			if(a[i]==a[j]) continue;
			for(int k=j-1;k>=0;k--)
			{
				if(a[k]!=a[i] and a[k]!=a[j] and a[i] < (a[k] + a[j])) 
				{
					sum++;
				}
				
				if(a[k]!=a[i] and a[k]!=a[j] and a[i] >= (a[k] + a[j])) 
				{
					break;
				}
				
			}
		}
	}
	
	cout<<sum;
}

int main()
{
	int n,d,ans=0;
	cin>>n>>d;
	while(n--)
	{
		int a,b; cin>>a>>b;
		long long int fl=a*a + b*b;
		float sum=sqrt(fl);
		if(sum<=d) ans++;
		
	}
	cout<<ans;
}
int main()
{
	int n,k; cin>>n>>k;
	int a[n],sum=0;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<k;i++) sum+=a[i];
	cout<<sum; 
}

int main()
{
	int n,k; cin>>n>>k;
	k%2==0 and k>=2*n and k<=4*n ? cout<<"Yes" : cout<<"No";
}

int main()
{
	int n; cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	unsigned long long ans=1,ANS;
	vector<int>v;
	for(int i=0;i<n;i++)
	{
		ans*=a[i];
		ANS=ans;
		while(ANS)
		{
			v.push_back(ANS%10);
			ANS/=10;
		}
		if(v.size()>1000000000000000000)
		{
			cout<<"HRE";
			cout<<"-1";
			return 0;
		}
		v.clear();
	}
	cout<<ans;
}

int main()
{
	int n; cin>>n;
	string s; cin>>s;
	if(s.size()<=n) cout<<s;
	else {
		
	for(int i=0;i<n;i++) cout<<s[i];
	cout<<"...";
}}

int main()
{
	long long int a,b,c,d; cin>>a>>b>>c>>d;
	long long int sum=0,count=0;
	if(a<=d)
	{
		sum+=a;
		d-=a;
		if(d==0)
		{
			cout<<sum;
			return 0;
		}
	}
	else 
	{
		cout<<d;
		return 0;
	}
	
		if(b<=d)
	{
		
		d-=b;
		if(d==0)
		{
			cout<<sum;
			return 0;
		}
	}
	else 
	{
		cout<<d;
		return 0;
	}
	
		if(c<=d)
	{
		sum-=c;
		d-=c;
		if(d==0)
		{
			cout<<sum;
			return 0;
		}
	}
	else 
	{
		cout<<sum-d;
		return 0;
	}
	
	
}


int main()
{
	int n,k; cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) a[i]=0;
	while(k--)
	{
		int d; cin>>d;
		for(int i=0;i<d;i++) 
		{
			int x; cin>>x;
			a[x-1]++;
		}
	}
	//cout<<a[2];
	int ans=0;
	for(int i=0;i<n;i++) if(a[i]==0) ans++; cout<<ans;
}
int main()
{
	long long int n,year=0; cin>>n;
	int a=100;
	while(a<n)
	{
		float aa=(1.0/100)*a;
		a+=floor(aa);
		year++;
	}
	cout<<year;
}*/
int main()
{
	 long long int n,m; cin>>n>>m;
	long long int sum=0,a[n];
	for(long long int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];	
	} 
	sort(a,a+n,greater<int>());
	double min=sum*1.0/(4*m);
	a[m-1]<min?cout<<"No": cout<<"Yes\n";	
}


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

int main(){

  int a,b,c;

  while(cin >> a >> b >> c){

    int z[] = {1,2,3,4,5,6,7,8,9,10},count = 0;

    z[a - 1] = 100;
    z[b - 1] = 100;
    z[c - 1] = 100;

    for(int i=0;i<10;i++){
      if(a + b + z[i] <= 20) count++;
    }

    if(count > 3) cout << "YES" << endl;
    else cout << "NO" << endl;

  }
} 

Measured memory_bytes: 1152
#include <bits/stdc++.h>
 using namespace std;
#define FIO              ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
//#define int              long long
#define mod              1000000007
#define eps              1e-9
#define setbits          __builtin_popcount
#define gcd              __gcd
#define rep(i,a,b)       for(int i=a;i<=b;i++)
#define repr(i,b,a)      for(int i=b;i>=a;i--)
#define forn(i,n)        for(int i=0;i<n;i++)
#define all(a)           a.begin(), a.end()
#define pb               push_back
#define endl             "\n"
#define ff               first
#define ss               second
#define asort(c)         sort(all(c)) 
#define lbpos(x,v)       (int)(lower_bound(all(v),x)-v.begin())
#define ubpos(x,v)       (int)(upper_bound(all(v),x)-v.begin())
#define PI               3.14159265358979323846
 using vi = vector<int>;
 using ii = pair<int,int>;
 using vii = vector<ii>;
 using ld = long double;
#define trace(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1)
{std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1,typename... Args>void ZZ(const char* names,Arg1&& arg1,
 Args&&... args)
{
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
clock_t time_p=clock();
void timer()
{
  time_p=clock()-time_p;
  cerr<<"Execution Time: "<<(double)(time_p)/CLOCKS_PER_SEC<<"\n";
}


int32_t main()
{
  FIO;
  
  int n;
  cin>>n;
  int ans=0;
  set<char> s;

  string a,b,c;
  cin>>a>>b>>c;
  {
    for(int i=0;i<n;i++)
    {
      s.clear();
      s.insert(a[i]);
      s.insert(b[i]);
      s.insert(c[i]);
      int ss=s.size();
      if(ss==3)
        ans+=2;
      else if(ss==2)
        ans+=1;

    }
  }
  cout<<ans;
  timer();
  return 0; 
}   


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <tuple>
#include <iomanip>


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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

//-------------------ここから-----------------------------------

int n, A, B, C;
int l[10];

int ans(int i, int a, int b, int c){
	if (i == n){
		if (a == 0 || b == 0 || c == 0){
			return 1e9;
		}
		else {
			return abs(a - A) + abs(b - B) + abs(c - C);
		}
	}

	int r = ans(i + 1, a, b, c);

	r = min(r, ans(i + 1, a + l[i], b, c) + (a == 0 ? 0 : 10));
	r = min(r, ans(i + 1, a, b + l[i], c) + (b == 0 ? 0 : 10));
	r = min(r, ans(i + 1, a, b, c + l[i]) + (c == 0 ? 0 : 10));

	return r;
}


int main(void){

	cin >> n >> A >> B >> C;

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

	cout << ans(0, 0, 0, 0) << endl;
}


Measured memory_bytes: 256
n = int(input())
red_point_list = [[int(j) for j in input().split()] for i in range(n)]
blue_point_list = [[int(j) for j in input().split()] for i in range(n)]

count = 0
for c, d in sorted(blue_point_list, key=lambda x: x[0]):
    tmp_index = 0
    tmp_y = -1
    for i, p in enumerate(red_point_list):
        if c > p[0] and d > p[1]:
            if p[1] >= tmp_y:
                tmp_index = i
                tmp_y = p[1]

    if tmp_y > -1:
        count += 1
        red_point_list.pop(tmp_index)

print(count)

Measured memory_bytes: 39024
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

string s;
int cnt[10];

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    if(!n)break;
    rep(i, n)cnt[i] = 0;
    int f = 0;

    cin >> s;
    rep(i, 100){
      int x = i % n;
      ++cnt[x];
      if(s[i] == 'S'){
        f += cnt[x];
        cnt[x] = 0;
      }else if(s[i] == 'L'){
        cnt[x] += f;
        f = 0;
      }
    }
    sort(cnt, cnt + n);
    rep(j, n)printf("%d ", cnt[j]);
    printf("%d\n", f);

//*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3308
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int h, w;
    while(cin >> w >> h, h || w) {
        char board[30][30];
        bool visit[30][30] = {};
        pii st;
        rep(i,0,h) rep(j,0,w) {
            cin >> board[i][j];
            if(board[i][j] == '@') {
                st = pii(i, j);
                visit[i][j] = true;
            }
        }

        int ans = 0;
        queue<pii> q;
        q.push(st);
        while(!q.empty()) {
            pii t = q.front(); q.pop();
            ans++;
            rep(i,0,4) {
                int x = t.fr + dx[i];
                int y = t.sc + dy[i];
                if(x < 0 || x >= h || y < 0 || y >= w) continue;
                if(board[x][y] == '#') continue;
                if(visit[x][y]) continue;
                visit[x][y] = true;
                q.push(pii(x, y));
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3132
line = input()
numbs = [int(v.strip()) for v in line.split()]


def is_equal(numb1, numb2):
    return numb1 == numb2

numb1, numb2, numb3 = numbs
res = sum([is_equal(numb1, numb2), is_equal(numb1, numb3), is_equal(numb2, numb3)])

if res == 1:
    print("Yes")
else:
    print("No")


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

int main(){
	int n;
	cin >> n;
	for(int i=1;i<=n;i++) {
		if((int)(i*1.08) == n) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=1100;
const int maxm=10100;
struct Edge
{
	int to,cap,rev,tag;
	Edge(){}
	Edge(int to,int cap,int rev,int tag):to(to),cap(cap),rev(rev),tag(tag){}
};
vector<Edge> g[maxn];
int lvl[maxn],iter[maxn];
queue<int> que;
inline void bfs(int x)
{
	memset(lvl,0x3f,sizeof(lvl));
	lvl[x]=0;
	que.push(x);
	while(!que.empty())
	{
		x=que.front();
		que.pop();
		for(int i=0;i<g[x].size();i++)
		{
			Edge &e=g[x][i];
			if(e.cap>0&&lvl[e.to]==inf)
			{
				lvl[e.to]=lvl[x]+1;
				que.push(e.to);
			}
		}
	}
}
inline int dfs(int x,int tar,int f)
{
	if(x==tar)return f;
	for(int &i=iter[x];i<g[x].size();i++)
	{
		Edge &e=g[x][i];
		if(e.cap>0&&(lvl[e.to]==lvl[x]+1))
		{
			int d=dfs(e.to,tar,min(e.cap,f));
			if(d>0)
			{
				e.cap-=d;
				g[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
inline void addedge(int a,int b,int c,int d)
{
	g[a].push_back(Edge(b,c,g[b].size(),d));
	g[b].push_back(Edge(a,0,g[a].size()-1,-1));
}
int maxflow(int s,int t)
{
	int flow=0;
	for(;;)
	{
		bfs(s);
	//	cout<<"bfs "<<lvl[t]<<endl;
		if(lvl[t]==inf)return flow;
		memset(iter,0,sizeof(iter));
		int f=0;
		while((f=dfs(s,t,inf))>0)flow+=f;
	}
}
bool reachS[maxn],reachT[maxn];
int n,m,s,t;
int ia[maxm],ib[maxm];
int main()
{
	while(~scanf("%d%d%d%d",&n,&m,&s,&t)&&n)
	{
		for(int i=1;i<=n;i++)g[i].clear();
		for(int i=1;i<=m;i++)
		{
			scanf("%d%d",&ia[i],&ib[i]);
			addedge(ia[i],ib[i],1,i);
		}
		int ans=maxflow(s,t);
		int cnt=0;
		bfs(s);
		memset(reachS,0,sizeof(reachS));
		memset(reachT,0,sizeof(reachT));
		reachS[s]=1;
		que.push(s);
		while(!que.empty())
		{
			int x=que.front();
			que.pop();
			for(int i=0;i<g[x].size();i++)
			{
				Edge &e=g[x][i];
				if(e.cap>0&&!reachS[e.to])
				{
					reachS[e.to]=1;
					que.push(e.to);
				}
			}
		}
		reachT[t]=1;
		que.push(t);
		while(!que.empty())
		{
			int x=que.front();
			que.pop();
			for(int i=0;i<g[x].size();i++)
			{
				Edge &e=g[x][i];
				if(g[e.to][e.rev].cap>0&&!reachT[e.to])
				{
					reachT[e.to]=1;
					que.push(e.to);
				}
			}
		}
		for(int x=1;x<=n;x++)if(reachT[x])
		{
			for(int i=0;i<g[x].size();i++)
			{
				Edge &e=g[x][i];
				if(e.tag>0&&reachS[e.to]&&e.cap>0)
				{
					if(!cnt)ans++;
					cnt++;
				}
			}
		}
		printf("%d %d\n",ans,cnt);
	}
	return 0;
}


Measured memory_bytes: 3676
#include <stdio.h>
#include <math.h>
#include <memory.h>
int f[1000001];
int main(void){
	int q,n,i,j,t,a,b,max,ans;
	scanf("%d",&q);
	while(q--){
		memset(f,0,sizeof(f));
		ans=0;
		scanf("%d",&n);
		while(1){
			if(n<10||f[n])
				break;
			t=max=0;
			for(i=n;i;i/=10)
				t++;
			for(i=1;i<t;i++){
				a=n/(int)pow(10,i);
				b=n%(int)pow(10,i);
				max=max>a*b?max:a*b;
			}
			n=max;
			ans++;
		}
		printf("%d\n",n<10?ans:-1);
	}
	return 0;
}

Measured memory_bytes: 4552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string a[101];
int main() {
	// 코틀린 ,문자열 알고리즘 보기, 앳코더, (시간되면 코드포스까지)
	ios_base::sync_with_stdio(false); cin.tie(NULL); //9 90 900 
	int n, k; cin >> n >> k;
	vector<string> v;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		v.push_back(a[i]);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
	}



}

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        // S
        string strS = Console.ReadLine();
        // T
        string strT = Console.ReadLine();

        var reg = new Regex("[a-z]");
        string resultS = reg.Replace(strS, "");
        string resultT = reg.Replace(strT, "");

        if ((strS.Length >= 1 && strS.Length <= 10) 
            && (string.IsNullOrWhiteSpace(resultS) && string.IsNullOrWhiteSpace(resultT))
            && (strS == strT.Substring(0, strS.Length) && strS.Length + 1 == strT.Length))
        {
            Console.WriteLine("Yes");
            return;
        }

        Console.WriteLine("No");
        return;
    }
}


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

#define int long long

int dp[50];
int n;

void init() {
  dp[0] = 1;
  for (int i = 0; i <= 30; i++) {
    for (int j = 1; j <= 3; j++) {
      dp[i+j] += dp[i];
    }
  }
}

signed main() {
  init();
  while (1) {
    cin >> n;
    if (n == 0) break;
    int mult = 3650;
    cout << (dp[n] + mult - 1) / mult << endl;
  }

  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int ask(int i) {
    string s;
    cout << i << endl;
    cin >> s;
    if(s == "Vacant") {
        return 0;
    } else if(s == "Male") {
        return 1;
    } else {
        return 2;
    }
}

int main() {
    int n;
    cin >> n;
    int l = ask(0);
    if(l == 0) {
        return 0;
    }
    int ok = 0, ng = n;
    while(1) {
        int mid = (ok + ng) / 2;
        int r = ask(mid);
        if(r == 0) {
            return 0;
        }
        if((l == r && mid % 2 == 0) || (l != r && mid % 2)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    return 0;
}

Measured memory_bytes: 852
import java.util.Scanner;
 
class Main {
	
	public static void cum(long sum[][]) {//左上からの累積和計算
		for (int i = 0; i < sum.length; i++) {
			for (int j = 1; j < sum[i].length; j++) {
				sum[i][j] += sum[i][j - 1];
			}
		}
		for (int i = 1; i < sum.length; i++) {
			for (int j = 0; j < sum[i].length; j++) {
				sum[i][j] += sum[i - 1][j];
			}
		}
	}

	public static long cumsum(int a, int b, int c, int d, long sum[][]) {//(a,b)より(c,d)の方が右下
		long cum = sum[c][d];
		if (b > 0) {
			cum -= sum[c][b - 1];
		}
		if (a > 0) {
			cum -= sum[a - 1][d];
		}
		if (a > 0 && b > 0) {
			cum += sum[a - 1][b - 1];
		}
		return cum;
	}
 
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int k=sc.nextInt();
        long map[][]=new long[n][m];
        for(int i=0;i<n;i++){
        	char s[]=sc.next().toCharArray();
        	for(int j=0;j<m;j++){
        		if(s[j]=='I')map[i][j]=1;
        		else if(s[j]=='O')map[i][j]=2000000;
        		else if(s[j]=='J')map[i][j]=4000000000000L;
        	}
        }
        cum(map);
        int a[]=new int[k];
        int b[]=new int[k];
        int c[]=new int[k];
        int d[]=new int[k];
        for(int i=0;i<k;i++){
        	a[i]=sc.nextInt()-1;
        	b[i]=sc.nextInt()-1;
        	c[i]=sc.nextInt()-1;
        	d[i]=sc.nextInt()-1;
        }
        for(int i=0;i<k;i++){
        	long x=cumsum(a[i],b[i],c[i],d[i],map);
        	int j=(int)(x/4000000000000L);
        	int o=(int)((x-j*4000000000000L)/2000000);
        	int ii=(int)(x-j*4000000000000L-o*2000000);
        	System.out.println(j+" "+o+" "+ii);
        }
    }}
        

Measured memory_bytes: 171044
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int main(){
    FIO
    int n;
    cin>>n;
    map<int,int>mp;
    for(int i=1;i<=n;i++){
        int a;
        cin>>a;
        mp.insert(pair<int,int>(a,i));
    }
    
    map<int,int> :: iterator it;
    for(it = mp.begin();it!=mp.end();it++){
        cout<<it->second<<" ";
    }
    
    
}

Measured memory_bytes: 5504