akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdlib.h>
using namespace std;

int N;
int A[210];         // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

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

    int res = 0;

    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            if(i == j){
            }else{
                if(res <= (abs(A[i] - A[j]))){
                    res = abs(A[i] - A[j]);
                }
            }
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n, m;

	long long ans=1;

	cin>>n>>m;

	if(abs(n-m)>1){
		cout<<0<<endl;
	}else if(abs(n-m)==1){
		rep(i, n){
			ans*=(i+1);
			if(ans>MOD) ans%=MOD;
		}
		rep(i, m){
			ans*=(i+1);
			if(ans>MOD) ans%=MOD;
		}
		cout<<ans<<endl;

	}else{
		rep(i, n){
			ans*=(i+1);
			if(ans>MOD) ans%=MOD;
		}
		rep(i, m){
			ans*=(i+1);
			if(ans>MOD) ans%=MOD;
		}
		ans*=2;
		if(ans>MOD) ans%=MOD;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
N,M = map(int,input().split())
X = list(map(int,input().split()))
if M == 1:
  print(0)
else:
  X.sort()
  A = [X[a + 1] - X[a] for a in range(M - 1)]
  A.sort(reverse=True)
  ans = X[-1] - X[0]
  for i in range(min(N - 1,M - 1)):
    ans -= A[i]
  print(ans)

Measured memory_bytes: 13968
#include<cstdio>
using namespace std;
int main(){
    int n,a[100001],ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=n;i++){
        if(i==a[a[i]]){
            ans++;
        }
    }
    printf("%d\n",ans/2);
}

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

int main() {
    int64_t N, M;
    cin >> N >> M;
    vector<int64_t> s(M), c(M);
    for (int64_t i = 0; i < M; i++) {
        cin >> s[i] >> c[i];
    }

    for (int64_t i = pow(10, N - 1) - (N == 1); i < pow(10, N); i++) {
        string str = to_string(i);
        assert(str.size() == N);
        bool ok = true;
        for (int64_t j = 0; j < M; j++) {
            if (str[s[j] - 1] != ('0' + c[j])) {
                ok = false;
            }
        }
        if (ok) {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;

}

Measured memory_bytes: 384
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int a = stdin.nextInt();
        int b = stdin.nextInt();
        int c = IntStream.of(a + b, a - b, a * b).max().getAsInt();
        System.out.println(c);
    }
}


Measured memory_bytes: 26964
using System;
class Program {
    static void Main (string[] arg) {
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int[] input2 = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
        double sum = 0;      
        for (int i = 0; i < n; i++) {
            sum += (double)input2[i];
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0;j < n - i - 1;j ++) {
                if (input2[j] < input2[j + 1]) {
                    int his = input2[j];
                    input2[j] = input2[j + 1];
                    input2[j + 1] = his;
                }
            }
        }
        //Console.WriteLine(string.Join(", ",input2));
        double min = (double)input2[m - 1];
        double criteria = sum/(4 * (double)m);
        //Console.WriteLine("min is {0} and criteria is {1}",min, criteria);
        if (min >= criteria) {
            Console.WriteLine("Yes");
        } else {
            Console.WriteLine("No");
        }
        
        
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<stdio.h>
using namespace std;
unsigned int GCD(unsigned int a,unsigned int b) {
	if(a < b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}
	if(b==0) return a;
	GCD(b,a%b);
}
int main() {
	unsigned int a;
	unsigned int b;
	while(cin >> a >> b) {
		unsigned int gcd = GCD(a,b);
		unsigned int lcm = (a / gcd) * b;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;
import java.math.BigDecimal;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        int min = 10000;
        int total = 0;
        int mind = 1;
        for(int i = 1; i <= N; i++){
            int num = (i + L - 1);
            total += num;
            int mindd = num < 0 ? -1 : 1;
            num = num < 0 ? -1 * num : num;
            if(min > num){
                min = num;
                mind = mindd;
            }
        }
        System.out.println(total - (mind * min));
    }
}


Measured memory_bytes: 23124
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
bool so(pair<pair<string, int>, int> a, pair<pair<string, int>, int> b){
  if(a.first.first != b.first.first){
    return a.first.first < b.first.first;
  }
  return a.first.second > b.first.second;
}
int main(){
  int N, M;
  cin >> N >> M;
  
  int L[M];
  int k;
  for(int m = 0; m < M; m++){
    cin >> k;
    L[m] = 0;
    for(int ki = 0; ki < k; ki++){
      int s;
      cin >> s;
      L[m] += (1 << (s-1));
    }
  }
  
  int p[M];
  for(int m= 0; m<M; m++){
    cin >> p[m];
  }
  
  int smax = 1 << N;
  // cout << smax << endl<< M << endl;
  
  int ans = 0;
  for(int s = 0; s < smax; s++){
    bool flag = true;
    for(int m = 0; m < M; m++){
      int an = s & L[m];
      // cout << s << ": " << L[m] << ", " << an << endl;
      int count = 0;
      
      for(int n = 0; n < N; n++){
        if(an % 2 == 1){
          count++;
        }
        an /= 2;
      }
      
      if((count % 2) != p[m]){
        flag = false;
        break;
      }
    }
    if(flag)
      ans++;
  }
  
  cout << ans << endl;

  return 0;
}

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

int main(){
  int H, W, x, y, r;

  cin >> W >> H >> x >> y >> r;
  if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H) {
    cout << "Yes" << endl;
  }
  else if(x-r < 0 || x+r > W || y-r < 0 || y+r > H){
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
def ifExit(a):
    if a[0] =='-1' and a[1] =='-1' and a[2] =='-1':
        return True
    else:
        return False



l=[]

while(True):
    tmp = input().split()
    if ifExit(tmp): break

    m=int(tmp[0])
    f=int(tmp[1])
    r=int(tmp[2])

    if (m < 0) or (f < 0) :
        l.append('F')
    elif (m+f >= 80):
        l.append('A')
    elif (80 > m+f and m+f >= 65):
        l.append('B')
    elif (65 > m+f and m+f >= 50):
        l.append('C')
    elif (50 > m+f and m+f >= 30):
        if r>=50:
            l.append('C')
        else:
            l.append('D')
    else:
        l.append('F')

print('\n'.join(l))

Measured memory_bytes: 7596
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define mper make_pair
#define PI 3.14159
#define fe first
#define se second
#define ll long long
//#define forik(i, a, b) for(ll i = a; i <= b; ++i)
//#define vl vector<ll>
//#define pll pair<ll, ll>
#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define saken string
#define all(x) (x).begin(), x.end()
using namespace std;

const ll MAXN = 2e5 + 200;
ll n, x;
bool used[MAXN];
vector <ll> to;

int main(){

cin >> n >> x;

ll m = n;

if(n == 2 && x == 2) {
    cout << "Yes\n";
    for(int i = 1; i <= 3; ++i) {
        cout << i << '\n';
    }
    return 0;
}

if(x == 1 || x == 2 * n - 1) {cout << "No";}

else {

    cout << "Yes\n";


    n *= 2;

    n--;

    ll l = 0;
    ll r = 0;

    if(x != n - 1) {

        to.pb(x + 1);
        to.pb(x);
        to.pb(x - 1);
        to.pb(x + 2);

        l = m - 1;
        r = m + x;

    }

    else if(x == n - 1){

        to.pb(x - 2);
        to.pb(x);
        to.pb(x + 1);
        to.pb(x - 1);

        l = m - 2;
        r = m + 1;

    }

    for(auto it : to) {
        used[it] = 1;
    }

    ll ct = 0;

    for(int i = 1; i <= n; ++i) {
        if(!used[i]) {cout << i << '\n';used[i] = 1; ct++;}
        if(ct == l - 1) {break;}
    }

    for(auto it : to) {
        cout << it << '\n';
    }

    for(int i = 1; i <= n; ++i) {
        if(!used[i]) {cout << i << '\n';}
    }


}

return 0;
}



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


set<int> t[10];
vector<int> a[10];

map< vector<int> , vector<int> >mp;

void calc(vector<int> a,int id){
  a[2]=(a[2]-a[0]+60)%60;
  a[1]=(a[1]-a[0]+60)%60;
  a[0]=0;
 
  vector<int> &G = mp[a];
  for(int i=0;i<(int)G.size();i++){
    t[id].insert(G[i]);

  }
}

int main(){
  vector<int> tmp(3),copy;
  
  for(int i=0;i<12;i++){
    for(int j=0;j<60;j++){
      for(int k=0;k<60;k++){
        int I=i*5+j/12;
        tmp[0]=I,tmp[1]=j,tmp[2]=k;
        sort(tmp.begin(),tmp.end());
        tmp[2]-=tmp[0];
        tmp[1]-=tmp[0];
        tmp[0]=0;
        mp[tmp].push_back(i*3600+j*60+k);
      }
    }
  }
  
  while(1){
    cin>>n;
    if(n==0)break;

    for(int i=0;i<n;i++){
      t[i].clear();
      t[i].insert(1e9);
      a[i].resize(3);
      for(int j=0;j<3;j++)cin>>a[i][j];
      sort(a[i].begin(),a[i].end());
      do
        calc(a[i],i);
      while(next_permutation(a[i].begin(),a[i].end()));
    }

    int ans=60*60*12,l,r;
    for(int i=0;i<60*60*12;i++){
      int maxm=i,mini=i;
      for(int j=0;j<n;j++){
        maxm=max(maxm, *t[j].lower_bound(i));
        mini=min(mini, *t[j].lower_bound(i));
      }
   
      if(ans>maxm-mini){
        ans=maxm-mini;
        l=mini;
        r=maxm;
      }
    }
   
    printf("%02d:%02d:%02d %02d:%02d:%02d\n",l/3600,l/60%60,l%60,r/3600,r/60%60,r%60);
  }
  return 0;
}

Measured memory_bytes: 1816
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    string S, T;
    cin >> S >> T;
    int s = S.size();
    int t = T.size();

    vector<string> list;

    for (int i = 0; i <= s - t; i++)
    {
        int flag = 1;
        int j = 0;
        for (; j < t; j++)
        {
            if (T[j] != S[i + j] && S[i + j] != '?')
            {
                flag = 0;
                break;
            }
        }
        // cout << "i:" << i << " j:" << j << endl;
        if (flag)
        {
            string tmp = "";
            tmp = S.substr(0, i);
            tmp += T;
            tmp += S.substr(i + t, s - (i + t));
            rep(k, tmp.size())
            {
                if (tmp[k] == '?')
                {
                    tmp[k] = 'a';
                }
            }
            list.push_back(tmp);
        }
    }
    if (list.size() == 0)
    {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    sort(list.begin(), list.end());
    cout << list[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    register int i,j;
    int n,k;
    scanf("%d%d",&n,&k);
    int sn[n];
    for(i = 0;i < n;i++)sn[i] = 0;
    for(i = 0;i < k;i++){
        int d;
        int t;
        scanf("%d",&d);
        for(j = 0;j < d;j++){
            scanf("%d",&t);
            sn[t-1]++;
        }
    }
    int cnt = 0;
    for(i = 0;i < n;i++)if(!sn[i])cnt++;
    printf("%d",cnt);
}

Measured memory_bytes: 1728
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    char c;
    cin >> c;
    puts(isupper(c) ? "A" : "a");
    return 0;
}

Measured memory_bytes: 3620
/*input
5 3
-30 -10 10 20 50
*/
#include <bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long a[1000005],n;

int main(){
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	#endif
	long long q,m,k,h,ans=1e18,sum=0,p,x,y;
	cin>>n>>k;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i+k-1<n;++i){
		long long l = a[i], r = a[i+k-1];
		if(l>=0){
			ans = min(ans,r);
		} else if(r<=0){
			ans = min(ans,abs(l));
		}
		else{
			ans = min(ans,abs(l) + abs(r) + min(abs(l),abs(r)) );
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int A;
	cin >> A;

	int B;
	cin >> B;

	int C;
	cin >> C;

	int X;
	cin >> X;

	int result = 0;

	for (int i = 0; i <= A; i++)
	{
		for (int j = 0; j <= B; j++)
		{
			for (int k = 0; k <= C; k++)
			{
				if ((500 * i + 100 * j + 50 * k) == X)
				{
					result++;
				}
			}
		}
	}

	cout << result;

	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, L = i2nn()
    a = L
    b = L + N - 1
    n = 0
    for i in range(a, b+1):
        n += i
    if a <= 0 and b >= 0:
        n -= 0
    else:
        c = abs(a)
        d = abs(b)
        if c < d:
            n -= a
        else:
            n -= b
    print(n)

main()


Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int ans = 0;
        if (k <= a) {
            ans += k;
            System.out.println(ans);
        } else {
            k -= a;
            ans += a;
            if (k <= b) {
                System.out.println(ans);
            } else {
                k -= b;
                if (k <= c) {
                    ans += k * -1;
                    System.out.println(ans);
                } else {
                    ans += k * -1;
                    System.out.println(ans);
                }
            }
        }

        sc.close();
    }

}


Measured memory_bytes: 35640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		
		if((A+B)%2!=0) {
			System.out.println("IMPOSSIBLE");
		}else {
			System.out.println((A+B)/2);
		}

	}

}


Measured memory_bytes: 21844
a,b,x=map(int,input().split())
import math

def gets(a,b,c):
    flg=True
    tanc=math.tan(c)
    if tanc>b/a:
        flg=False
    
    if flg:
        ans=a*b-a*a*math.tan(c)/2
    else:
        ans=(b*b/math.tan(c))/2
    return ans*a

now=45
haba=22.5

"""
for i in range(90):
    m=i-0.0001
    print(gets(a,b,math.radians(i)))

print()    
"""

if a*a*b==x:
    print(0)
else:
    
    
    for bis in range(100000):
        c=math.radians(now)
        #print(gets(a,b,c),now,haba)
        res=gets(a,b,c)
        if abs(res-x)<10**-15:
            print(now)
            break
        elif res<x:
            now=(now-haba)
        else:
            now=(now+haba)
        haba/=2
    else:
        print(now)


Measured memory_bytes: 3064
#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[i];
  }
  int sum=0;
  for (int i=0;i<N;i++){
    if (i%2==0){
      sum+=A[i];
    }
    else {
      sum-=A[i];
    }
  }
  cout << sum;
  int ans=sum;
  for (int i=0;i<N-1;i++){
    ans=2*A[i]-ans;
    cout << ' ' << ans;
    if (i==N-2){
      cout << endl;
    }
  }
}

Measured memory_bytes: 1664
package main
import (
	"fmt"
	"strings"
)

func main() {
	var (
		height, width int
		row string
		isAllBlank bool
	)
	fmt.Scan(&height, &width)

	matrix := make([][]string, height)
	for h := 0; h < height; h++ {
		fmt.Scan(&row)
		if strings.Count(row, ".") != width {
			matrix[h] = strings.Split(row, "")
		}
	}

	// delete col is all blank
	for w := 0; w < width; w++ {
		isAllBlank = true
		for h := 0; h < height; h++ {
			if matrix[h] != nil && matrix[h][w] == "#" {
				isAllBlank = false
				break
			}
		}

		if isAllBlank {
			for h := 0; h < height; h++ {
				if matrix[h] != nil {
					matrix[h][w] = ""
				}
			}
		}
	}

	for h := 0; h < height; h++ {
		if matrix[h] != nil {
			fmt.Println(strings.Join(matrix[h], ""))
		}
	}
}


Measured memory_bytes: 896
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll x, ll a, ll b) {
  cout << "AB"[abs(x - a) > abs(x - b)] << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll b;
	ll a;
	ll x;
	scanf("%lld", &x);
	scanf("%lld", &a);
	scanf("%lld", &b);
	solve(x, a, b);
	return 0;
}


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

int main() {
  int n, k, s;
  cin >> n >> k >> s;

  if (s > n) {
    for (int i = 0; i < n; i++) {
      if (i < k) cout << s;
      else cout << 1;

      if (i == n - 1) cout << endl;
      else cout << ' ';
    }
  }
  else {
    const int max_v = 1e9;
    for (int i = 0; i < n; i++) {
      if (i < k) cout << s;
      else cout << max_v;

      if (i == n - 1) cout << endl;
      else cout << ' ';
    }
  }
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define len(s) (int)s.size()
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define mod 1e9+7
#define limit 200005
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define d1(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define d2(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define d3(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" = "<<z;
#define GG {printf("-1"); return 0;}
#define inf 1e9*2
#define y1 asdas
#define ll long long
#define writesize(a) printf("%d\n",len(a));
#define writeall(a) for(int i=0;i<len(a);i++) printf("%d ",a[i]);
int main()
{
	int n;
	scanf("%d",&n);
	printf("ABC%d",n);
}



Measured memory_bytes: 764
#include<stdio.h>
int main(void){
       int A,B,C;
       scanf("%d %d %d",&A,&B,&C);
       if(A==B)
        printf("%d",C);
       else
       {
           if(A==C)
            printf("%d",B);
           else
            printf("%d",A);
       }


       }


Measured memory_bytes: 128
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 29)
#define LLINF (1LL << 61)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define TO_STRING(VariableName) # VariableName

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }

int main() {
	int n;
	string s[2];
	cin >> n >> s[0] >> s[1];

	ll ans = 1;
	for (int i = 0; i < n; ++i) {
		if (i < n - 1 && s[0][i] == s[0][i + 1] && s[1][i + 1] == s[1][i + 1]) {
			if (i == 0)
				ans *= 6;
			else if (s[0][i - 1] == s[1][i - 1])
				ans *= 2;
			else
				ans *= 3;
			i++;
		}
		else {
			if (i == 0)
				ans *= 3;
			else if (s[0][i - 1] != s[1][i - 1])
				ans *= 1;
			else
				ans *= 2;
		}
		ans %= MOD7;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 888
import java.util.Scanner;

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

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		sc.close();
		long num=1;
		for(int i=0;i<n;i++) {
			num += Math.min(num, k);
		}
		System.out.println(num);
	}

}


Measured memory_bytes: 23252
#include <stdio.h>

int main(){
  int N,i,S=0;
  scanf("%d",&N);
    for(i=1;i<100000;i++){
      if(N<i*i){
        S=(i-1)*(i-1);
        break;
      }
    }
    printf("%d",S);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5 + 5;
char s[N];
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    scanf("%s",s + 1);
    int ok = 1;
    for(int i = 2; i <= 4; i++) if(s[i] == s[i - 1]) ok = 0;
    if(ok) cout << "Good";
    else cout << "Bad";
    return 0;
}


Measured memory_bytes: 256
import qualified Data.Map as Map

ptn = [[(74,1)], [(2,1),(24,1)], [(4,1),(14,1)], [(2,1),(4,2)]] -- [[(e,c)]] : factor ^ e, c is num of e  

scan :: Int -> Int
scan n = iter ptn where
    iter [] = 0
    iter (p:ps) = iter1 [] (combsIn p) + iter ps
    iter1 _ [] = 1
    iter1 used (g:gs) = sum (map comb g) where
        comb c  | c == [] = 0
                | any (\x -> elem x used) c = 0
                | otherwise = iter1 (c++used) gs
    combsIn = map (\(e, c) -> combinations (Map.keys (Map.filter (>= e) (factorial n))) c)

combinations :: [a] -> Int -> [[a]]
combinations l r = comb (length l) r l where
    comb _ 0 _ = [[]]
    comb 0 _ _ = []
    comb n r al@(x:xs) 
        | n == r = [al]
        | otherwise = map (x:) (comb (n-1) (r-1) xs) ++ comb (n-1) r xs

factorial:: Int -> Map.Map Int Int
factorial = iter Map.empty where
    iter m 0 = m
    iter m n = iter (Map.unionWith (+) m (factors n)) (n-1)

factors :: Int -> Map.Map Int Int
factors = iter Map.empty divisors where
    iter m (d:ds) n
        | n == 1    = m
        | n >= d*d  = case logP d n of
            Just (e, n') -> iter (Map.insert d e m) ds n'
            Nothing      -> iter m ds n          
        | otherwise = Map.insert n 1 m 

logP :: Int -> Int -> Maybe (Int, Int)
logP p n = if mod n p == 0 then iter 0 n else Nothing where
        iter e x = case divMod x p of
            (1, 0) -> Just (e+1, 1)
            (q, 0) -> iter (e+1) q
            (_, _) -> Just (e, x)

divisors :: [Int]
divisors = 2:3:(iter [5,11..] [7,13..]) where
    iter (x:xs) (y:ys) = x:y:(iter xs ys)

main :: IO() 
main = do
    n  <- readLn :: IO Int
    let ans = scan n
    print ans

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


ll to[65][100005];
ll pos[65][100005];
int main(){
	ios_base::sync_with_stdio(false);
	ll N, M, K;
	ll x[100005], a[100005];

	cin >> N;
	rep(i,N) cin >> x[i];
	cin >> M >> K;
	rep(i,M){
		cin >> a[i];
		a[i]--;
	}

	rep(i,N-1) to[0][i] = i;
	rep(i,M) swap(to[0][a[i]-1], to[0][a[i]]);
	rep(k,63) rep(i,N-1) to[k+1][i] = to[k][ to[k][i] ];
	
	rep(i,N-1) pos[0][i] = i;
	rep(k,63){
		if( (1ll<<k) & K ){
			rep(i,N-1) pos[k+1][i] = pos[k][ to[k][i] ];
		}else{
			rep(i,N-1) pos[k+1][i] = pos[k][i];
		}
	}

	cout << x[0] << endl;
	ll cur = x[0];
	rep(i,N-1){
		int n = pos[63][i];
		cur += x[n+1] - x[n];
		cout << cur << endl;
	}

	return 0;
}


Measured memory_bytes: 103680
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);


#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;


int main(){
    ll n;
    cin >> n;
string s;
    cin >>s;
    if ( s.size()%2==1){
        cout << "No\n";
    }else{
        ll t =s.size()/2;
        bool ctr =1;
        for (int i = 0; i <(t) ; ++i) {
            if(s[i]!=s[i+t])ctr=0;
        }
        if(ctr == 1){
            cout<<"Yes\n";
        }else{
            cout<<"No\n";
        }
    }


    return 0;
}




    /*

    int gcd(int a, int b) {
        while (a > 0 && b > 0)
            if (a > b) a %= b;
            else b %= a;
        return a + b;
    }

    int lcm(int a, int b) {
        return a*b / gcd(a,b);
    }
    long long fast_exp(long long n,long long k){
        if(k == 0)
            return 1;
        if(k==1)
            return n;

        long long temp = fast_exp(n,k>>1);
        if((k&1)==1)
            return (n*temp*temp);
        return (temp*temp);

    }

     */

Measured memory_bytes: 256
#include <iostream>

int main(){
    uint64_t m,n,q = 1000000007,nl;
    std::cin >> m >> n;

    uint64_t r = 1;
    uint64_t m2 = m*m;
    uint64_t m4 = m2*m2;
    uint64_t i = 0;
    nl = n-i;
    for(uint64_t j=0;j<nl/4;j++)
    {
        r = (r*m4) %q;
        i += 4;
    }
    for(;i<n;i++)
    {
        r = (r*m) %q;
    }
    std::cout << r << "\n";
    return 0;
}




Measured memory_bytes: 3116
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int sum[N];
int flag[N];
vector<pair<int, int>> v[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
	{
		int l, r, c;
		scanf("%d%d%d", &l, &r, &c);
		v[c].emplace_back(l * 2 - 1, r * 2 - 1);
	}
	for (int i = 1; i <= m; i++)
	{
		MEM(sum, 0);
		for (auto& p : v[i])
		{
			sum[p.first]++;
			sum[p.second + 1]--;
		}
		for (int j = 1; j < N; j++)
		{
			sum[j] += sum[j - 1];
			if (sum[j])
				flag[j] |= 1 << (i - 1);
		}
	}
	int ans = 0;
	for (int i = 1; i < N; i++)
	{
		int x = flag[i];
		int cnt = 0;
		while (x)
			cnt++, x -= (x & -x);
		ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7680
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	cin >> s;
	string t = "";
	for(int i = s.length() - 1; i >= 0; i--){
		if(s[i] == 'b') t += "d";
		else if(s[i] == 'd') t += "b";
		else if(s[i] == 'p') t += "q";
		else t += "p";
	}
	if(s == t) cout << "Yes" << endl;
	else cout << "No" << endl;
	cout << endl;
	return 0;
}

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

int main() {
    int n, z, w;
    cin >> n >> z >> w;

    vector<int> v(n);
    for(auto& e: v) cin >> e;

    int ans = abs(v[n-1] - w);
    if(n > 1) ans = max(ans, abs(v[n-1] - v[n-2]));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
class Combination:
    def __init__(self, max_n, _mod):
        self.mod = _mod

        self.fac = [0 for _ in range(max_n + 10)]
        self.finv = [0 for _ in range(max_n + 10)]
        self.inv = [0 for _ in range(max_n + 10)]

        self.fac[0], self.fac[1] = 1, 1
        self.finv[0], self.finv[1] = 1, 1
        self.inv[1] = 1

        for i in range(2, max_n + 10):
            self.fac[i] = self.fac[i - 1] * i % self.mod
            self.inv[i] = self.mod
            self.inv[i] -= self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % self.mod

    def mod_comb(self, n, k):
        if n < k or n < 0 or k < 0:
            return 0

        res = self.fac[n] * (self.finv[k] * self.finv[n - k] % self.mod)
        res %= self.mod

        return res


def main():
    mod = 998244353
    N, M, K = map(int, input().split())

    comb = Combination(N, mod)

    ans = 0
    for i in range(K + 1):
        add_v = M * pow(M - 1, N - i - 1, mod) % mod
        add_v = (add_v * comb.mod_comb(N - 1, i)) % mod
        ans = (ans + add_v) % mod

    print(ans)


main()

Measured memory_bytes: 32860
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = []

    t = A[:]
    a = min(A)
    a_idx = A.index(a)
    for i in range(N):
        t[i] += a
        if t[i] > 0:
            ans = []
            break
        else:
            if i != a_idx:
                ans.append((a_idx + 1, i + 1))

    if len(ans) != 0:
        ans.append((a_idx + 1, a_idx + 1))
        for i in range(N, 1, -1):
            ans.append((i, i - 1))
        print(len(ans))
        for a in ans:
            print(a[0], a[1])
        return

    t = A[:]
    a = max(A)
    a_idx = A.index(a)
    for i in range(N):
        t[i] += a
        if i != a_idx:
            ans.append((a_idx + 1, i + 1))
    ans.append((a_idx + 1, a_idx + 1))
    for i in range(1, N):
        ans.append((i, i + 1))
    print(len(ans))
    for a in ans:
        print(a[0], a[1])
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3896
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)

int main()
{
    int X;
    cin >> X;
    REP(i, X + 1)
    {
        int b = 100 * i;
        int rem = X - b;
        if (rem >= 0 and rem <= 5 * i)
        {
            puts("1");
            return 0;
        }
    }
    puts("0");
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    while (in.hasNext()) {
      int x1 = in.nextInt();
      int y1 = in.nextInt();
      int x2 = in.nextInt();
      int y2 = in.nextInt();
      int xDiff = x2 - x1;
      int yDiff = y2 - y1;

      System.out.printf("%d %d %d %d\n", x2 - yDiff, y2 + xDiff, x1 - yDiff, y1 + xDiff);
    }
  }
}

Measured memory_bytes: 21588
#include<stdio.h>
long long int n, a[200100],b[200100][2],sum, k;
long long int s;
int main(){
	int i, j=0;
	scanf("%lld",&n);
	b[0][0]=0;
	for(i=0;i<n;i++){
		scanf("%lld",a+i);
		s=0;
		while(a[i]<=b[j][0]){
			s=s+b[j][1];
			k=k-b[j][0]*b[j][1];
			j--;
		}
		b[++j][0]=a[i];
		b[j][1]=++s;
		k=k+(a[i]*s);
		sum=sum+k;
	}
	printf("%lld",sum);
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;


const long long MAX = 2010;
const long long MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

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

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


int main(){
  int K, N; cin >> N >> K;
  COMinit();

  reps(i,K){
    ll ans = COM(N-K+1,i)*COM(K-1,i-1);
    ans %= MOD;
    cout << ans << endl;
  }


  // cout << fixed << setprecision(10);
  
  return 0;
}

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

using namespace std;

// #define LOG(...) fprintf(stderr, __VA_ARGS__)
#define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define RFOR(i, a, b) for(int i = (int)(b - 1); i >= (int)(a); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
#define BIT(x, i) (((x) >> (i)) & 1)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vc> vvc;
typedef vector<vll> vvll;

int h, w, n;

bool update(vvc field, int X, int Y) {
  swap(field[Y][X], field[Y][X + 1]);

  bool update = true;
  while(update) {
    update = false;

    // drop
    REP(x, w) RREP(y, h) {
      if (field[y][x] == '.') {
        RFOR(yy, 0, y) {
          if (field[yy][x] != '.') {
            swap(field[y][x], field[yy][x]);
            update = true;
            break;
          }
        }
      }
    }
    LOG("droped\n");
    REP(y, h) {
      REP(x, w){
        LOG("%c", field[y][x]);
      }
      LOG("\n");
    }
    LOG("---------\n");

    // delete
    vvb dlfield(h, vb(w, false));
    REP(y, h) {
      REP(x, w - n + 1){
        if (field[y][x] == '.') continue;
        bool flag = true;
        FOR(d, 1, n){
          if (field[y][x] != field[y][x + d]) {
            flag = false;
            break;
          }
        }
        if (flag) {
          REP(d, n) dlfield[y][x + d] = true;
        }
      }
    }
    REP(x, w){
      REP(y, h - n + 1) {
        if (field[y][x] == '.') continue;
        bool flag = true;
        FOR(d, 1, n){
          if (field[y][x] != field[y + d][x]) {
            flag = false;
            break;
          }
        }
        if (flag) {
          REP(d, n) dlfield[y + d][x] = true;
        }
      }
    }
    LOG("deleted\n");
    REP(y, h) {
      REP(x, w){
        if (dlfield[y][x]) {
          update = true;
          field[y][x] = '.';
        }
      }
    }
    REP(y, h) {
      REP(x, w){
        LOG("%c", field[y][x]);
      }
      LOG("\n");
    }
    LOG("---------\n");
  }

  int cnt = 0;
  REP(y, h) REP(x, w){
    if (field[y][x] == '.') cnt++;
  }
  LOG("e:%d v:%d\n", w * h, cnt);
  return cnt == w * h;
}

int main() {
  cin >> h >> w >> n;
  vvc field(h, vc(w));
  REP(y, h) REP(x, w){
    cin >> field[y][x];
  }

  RREP(y, h) REP(x, w - 1){
    if (field[y][x] == field[y][x + 1])
      continue;
    if (update(field, x, y)) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 3156
import math
N = int(input())
kari = N*100/108
hako = math.ceil(kari)
ans = math.floor(kari)
if  hako*108/100==N or ans*108/100==N:
    print(math.floor(kari))
elif math.floor(hako*108/100)==N:
    print(hako)
elif math.floor(ans*108/100)==N:
    print(ans)
#elif math.ceil(hako*108/100)==N:
 #   print(hako)
#elif math.ceil(ans*108/100)==N:
 #   print(ans)
else:
    print(":(")

Measured memory_bytes: 3060
h, w, m = map(int,input().split())

h_dict = dict()
w_dict = dict()

targets = list()

for i in range(m):
    temp_h, temp_w, = map(int,input().split())

    h_dict[temp_h] = h_dict.get(temp_h, default=0) + 1
    w_dict[temp_w] = w_dict.get(temp_w, default=0) + 1

    targets.append((temp_h, temp_w))

h_dict_values = list(h_dict.values())
w_dict_values = list(w_dict.values())

max_h = max(h_dict_values)
max_w = max(w_dict_values)

nh = h_dict_values.count(max_h)
nw = w_dict_values.count(max_w)

x = 0

for i in range(m):
    temp_h, temp_w = targets[i]
    if h_dict[temp_h]==max_h and w_dict[temp_w]==max_w:
        x += 1

ans = max_h + max_w

if x == nh * nw:
    ans -= 1

print(ans)

Measured memory_bytes: 176840
"""
＋を挟むか挟まないかは2**N通り。(Nはlen(s))
二進数で表してi番目のビットが0ならi番目の数字の右に＋を挟む。1なら挟まないという方針
"""
s=input()
l=list(s)
#lst=[]
lst_2=0
'''
bi=[bin(2**i) for i in range(0,len(s))]
print(bi)
'''
for i in range(1<<(len(s)-1)):#2**(len(s)-1)と同じ
    st=l[0]#l[0]の左に＋が来ることはない
    for j in range(len(s)-1):#sを二進数で表示した時に数字の間にプラスを挟むかどうかを決めるループ
        if (i>>j)&1:#iのj+1番目のビットが1だったら+を挟まない。
            st+=l[j+1]
        else:#iのj+1番目のビットが0だったら＋を挟む
            st+='+'+l[j+1]
    #lst.append(eval(st))
    lst_2+=eval(st)
    #print(lst)
    #print(lst_2)
#print(sum(lst))
print(lst_2)

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

ll const MAX=1001001001001;

int main(){
  ll  n,m;
  std::cin >> n>>m;
  std::vector<ll> h(n,0);

  std::vector< vector<ll> > r(n);
  std::vector<int> ans(n,-1);//0悪い展望台


  rep(i,n)std::cin >> h[i];
  rep(i,m){
    int tema,temb;
    std::cin >> tema >> temb;
    tema--;
    temb--;
    r[tema].push_back(temb);
    r[temb].push_back(tema);

    if(h[tema]==h[temb]){
      ans[tema]=0;
      ans[temb]=0;
    }
    if(h[tema]>h[temb])ans[temb]=0;
    if(h[tema]<h[temb])ans[tema]=0;

  }

  int ians=0;
  rep(i,n){
    if(ans[i]!=0)ians++;
  }
  std::cout <<ians << '\n';


  return 0;
}


Measured memory_bytes: 10372
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize,
        d: [u64; n]
    }

    let mut dm = d;
    dm.sort();
    let mut cnt = 1;
    let mut last = dm[0];
    for i in 1..n {
        if last != dm[i] {
            cnt += 1;
            last = dm[i];
        }
    }
    println!("{}", cnt);
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int N = 30;
const int M = 50;

int n, m, ans;
vector<int> G[N];
vector<pair<int, int> > data;

void solve(int idx, int sum, long long used){
  if(idx == n){
    if(used == (1 << n) - 1) ans = min(ans, sum);
  }else{
    int pos = data[idx].second;
    long long next = used | (1 << pos);
    for(int i=0;i<G[pos].size();i++) next |= (1 << G[pos][i]);
    solve(idx + 1, sum + 1, next);
    solve(idx + 1, sum, used);
  }
}

main(){
  while(cin >> n >> m && (n|m)){
    for(int i=0;i<n;i++) G[i].clear();
    data.clear();
    ans = N;
    for(int i=0;i<m;i++){
      int a, b;
      cin >> a >> b;
      G[a].push_back(b);
      G[b].push_back(a);
    }
    for(int i=0;i<n;i++) data.push_back(make_pair(G[i].size(), i));
    sort(data.begin(), data.end());
    reverse(data.begin(), data.end());
    solve(0, 0, 0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

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

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

#define lson l, m, rt*2
#define rson m + 1, r, rt*2+1
#define xx first
#define yy second

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> pii;

int main() {
#ifdef JUDGE
  freopen("case.in", "r", stdin);
#endif
  LL n, m;
  cin >> n >> m;
  cout << min(m / 2, (n * 2 + m) / 4) << endl;
  return 0;
}


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

using namespace std;

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

  int x;
  cin >> x;
  int ans = 1000 * (x/500);
  x = x%500;
  ans += 5 * (x/5);
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i<N; i++)
#define RVROOP(i, N) for(int i=N; i>=0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int N, X; cin>>N>>X;
  int L[N];
  int D=0, ans=1;
  for(int i=0; i<N; i++){
    cin>>L[i];
    D+=L[i];
    if(D>X){
      break;
    }
    ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256