akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws IOException {

    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready()) {
      String data = input.readLine();
      String alterString = "";
      boolean okFlag = false;
      for (int i = 1; i < 27; i++) {
        alterString = getCeaserCipherString(data, i);
        for (String eachString : alterString.split(" ")) {
          if (eachString.equals("the") | eachString.equals("this") | eachString.equals("that")) {
            okFlag = true;
            break;
          }
        }
        if (okFlag) {
          System.out.println(alterString.trim());
          break;
        }
      }
    }
  }

  private static String getCeaserCipherString(String string, int replaceNum) {
    String retString = "";
    char[] charArray = string.toCharArray();
    for (char eachChar : charArray) {
      retString += getCeaserCipherChar(eachChar, replaceNum);
    }
    return retString;
  }

  public static char getCeaserCipherChar(char c, int replaceNum) {
    ArrayList<Character> abcArray = new ArrayList<>(
        Arrays.asList('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
            's', 't', 'u', 'v', 'w', 'x', 'y', 'z'));

    if (c == '.' | c == ' ')
      return c;

    int indexBefor = abcArray.indexOf(c);

    if (indexBefor + replaceNum >= abcArray.size()) {
      return abcArray.get(indexBefor + replaceNum - abcArray.size());
    } else {
      return abcArray.get(indexBefor + replaceNum);
    }
  }
}

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

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

Measured memory_bytes: 3628
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  string s;
  cin >> s;

  string bef = "";
  ll cnt = 0;
  rep(i,sz(s))
  {
    ll tail = -1;
    for(ll j = i;j < sz(s); ++j)
    {
      if(s.substr(i,j-i+1) != bef)
      {
        tail = j;
        break;
      }
    }
    if(tail == -1)continue;
    bef = s.substr(i,tail - i + 1);
    i = tail;
    cnt++;
  }

  cout << cnt << endl;


  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

int main() {
	int n, h[100001], max=0, idx=0, count=0;
	cin>>n; for(int i=0;i<n;i++) cin>>h[i];
	
	while(idx<n-1){
		if(h[idx]>=h[idx+1]){
			count++;
			idx++;
		}
		else{
			idx++;
			count=0;
		}
		if(count>max) max=count;
	}
	cout<<max;
	return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;
int dp[100001];

int main()
{
	int n,k;
	cin>>n>>k;
	vector<int> vec(n+1);
	
	for(int i = 0;i<n;i++)
	{
		cin>>vec[i];
	}
	
	for(int i = n-2;i>=0;i--)
	{
		int mini = INF;
		for(int j = 1;j<=k;j++)
		{
			int pos = i + j;
			if(pos >= n) continue;
			mini = min(mini , abs(vec[pos] - vec[i]) + dp[pos]);	
		}	
		dp[i] = mini;
	}	
	
	cout<<dp[0]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
    int N, D, result;
    scanf("%d %d", &N, &D);
    result = N / (D * 2 + 1);
    if(N % (D * 2 + 1) != 0)
        result++;
    printf("%d\n", result);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


string solve(const vci& p) {
	string cperm = "14141212";
	string mperm = "44444444";
	int mcust = iINF;
	
	for_(i, 0, 8) {
		int cust = 0;
		
		for_(j, 0, 8) {
			int sub = p[j] - (cperm[j]-'0');
			if (sub>0) cust += sub;
		}
		
		if (cust < mcust) {
			mcust = cust;
			mperm = cperm;
		} else if (cust==mcust) {
			if (cperm < mperm) mperm = cperm;
		}
		
		cperm = cperm.substr(1, 7) + cperm[0];
	}
	
	return mperm;
}

int main() {
	vci p(8);
	
	while (cin>>p[0]) {
		for_(i, 1, 8) cin>>p[i];
		
		string ans = solve(p);
		for_(i, 0, 7) cout << ans[i] << " ";
		cout << ans[7] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1204
//もらうdp
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    ll N;
    cin >> N;
    ll dp[MAX];
    ll i, j;
    
    for(i=1; i<=N; i++) dp[i]=INF;
    
    dp[0]=0;
    for(i=1; i<=N; i*=6) {
        for(j=i; j<=N; j++) {
            chmin(dp[j], dp[j-i]+1);
        }
    }
    
    for(i=1; i<=N; i*=9) {
        for(j=i; j<=N; j++) {
            chmin(dp[j], dp[j-i]+1);
        }
    }
    
    pt(dp[N]);
}


Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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

const ll INF=1e18;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.rbegin(),a.rend());
    priority_queue<pair<ll,pll>> PQ;
    ll ans=0;
    pll p;
    p.fi=a[0];
    p.se=a[0];
    PQ.push(make_pair(a[0],p));
    for(ll i=1;i<n;i++){
        pair<ll,pll> s=PQ.top();
        PQ.pop();
        ans+=s.fi;
        pll t=make_pair(s.se.fi,a[i]);
        pll u=make_pair(s.se.se,a[i]);
        PQ.push(make_pair(min(s.se.fi,a[i]),t));
        PQ.push(make_pair(min(s.se.se,a[i]),u));
    }
    cout << ans << endl;
    return 0;
}

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    ll A;
    cin >> A;
    string S;
    cin >> S;

    string tmp = "";
    rep(i, S.size()) {
        if (S[i] == '.') continue;
        tmp += S[i];
    }
    ll tmpv = stol(tmp);

    cout << (A * tmpv) / 100 << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
	int i;
	char s[3];
	 for(i=0;i<3;i++){
		scanf("%c",&s[i]);
        }
	if(s[0]=='a'||s[1]=='a'||s[2]=='a'){
		if(s[0]=='b'||s[1]=='b'||s[2]=='b'){
			if(s[0]=='c'||s[1]=='c'||s[2]=='c') {
				printf("Yes\n");
			}else  printf("No\n");
		}else printf("No\n");
	}else printf("No\n");
	return 0;
}


Measured memory_bytes: 128
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = inp()
if s[0] == s[1] and s[1] == s[2]:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
//Be Name Khoda
//man az biganegan  hargez  nanalam
//ke harche kard ba man ashena kard
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); }
#define MKP make_pair
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
#define GEI(x) scanf("%d",&x)
#define GEL(x) scanf("%lld",&x)
#define ALL(x) x.begin(),x.end()
const ll M=4e6+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=998244353;

map<str,ll> mm;

void orr(str &s,const str &t)
{
    For(i,0,SZ(t))
        if (t[i]=='0') s[i]='0';
}

ll f(str s)
{
    if (s=="") return 1;
    if (mm[s]!=0) return mm[s];
    
    ll res=f(s.substr(1,SZ(s)-1));
    if (s[0]=='1') res*=2;
    For(i,2,SZ(s)+1)
    {
        str h="";
        For(j,1,SZ(s)/i+1)
        {
            //ER(i);
            //ER(j);
            h+="1";
            str t=h;
            For(ii,0,i)
            {
                orr(t,s.substr(ii*j,j));
            }
            res+=(f(t)*f(s.substr(i*j,SZ(s)-i*j)))%mod;
        }
    }
    //ER(s);
    //ER(res);
    res%=mod;
    mm[s]=res;
    return res;
}

int main()
{
    str s;
    cin >> s;
    RET(f(s));
}

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

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

    int H,W,A,B; cin>>H>>W>>A>>B;
    vector<string> s(H,string(W,'0'));
    for(int i=0;i<B;i++) for(int j=0;j<A;j++){
        s[i][j]='1';
    }
    for(int i=B;i<H;i++) for(int j=A;j<W;j++){
        s[i][j]='1';
    }
    for(int i=0;i<H;i++){
        cout<<s[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 2304
#include<cstdio>

int a,b,c;

int main(){
	scanf("%d %d %d",&a,&b,&c);
	
	if(a+b == c) printf("Yes\n");
	else if(a+c == b) printf("Yes\n");
	else if(b+c == a) printf("Yes\n");
	else printf("No\n");
	
	return 0;
}

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

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

  int x=1;

  for(int i =0; i<N; i++){
    if (x<K)
    x*=2;
    else
    x+=K;
  }

  cout <<x<<endl;

}


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

int N, M, A, B, C, D, S, G, V, P;
int K[32][32];
const int inf = 1001001001;

int main() {
  scanf("%d%d", &N, &M);

  for (int i = 0; i<M; i++) {
    for (int j = 0; j<M; j++) {
      K[i][j] = inf;
    }
  }

  for (int i=0; i<M; i++) {
    scanf("%d, %d, %d, %d", &A, &B, &C, &D);
    K[A-1][B-1] = C;
    K[B-1][A-1] = D;
  }
  scanf("%d, %d, %d, %d", &S, &G, &V, &P);

  for (int k=0; k<N; k++) {
    for (int i=0; i<N; i++) {
      for (int j=0; j<N; j++) {
        K[i][j] = min(K[i][j], K[i][k] + K[k][j]);
      }
    }
  }

  cout << V - P - K[S-1][G-1] - K[G-1][S-1] << endl;

}



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

#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int x, a; cin >> x >> a;
    cout << (x < a ? 0 : 10) << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <string>

typedef int64_t lint;
#define LINT_MAX INT32_MAX
#define LINT_MIN INT32_MIN

using namespace std;

int main(void) {
    int d,n;
    cin >> d >> n;
    if(n == 100)
        cout << "101";
    else
        cout << n;
    for(int i = 0;i < d;i++)
        cout << "00";
    return 0;
}


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

int main () {
  int n;
  cin >> n;
  vector<ll> s(n+1, 0);
  rep(i,n) {
    int a;
    cin >> a;
    s[i+1] = s[i] + a;
  }

  ll ans = 2e15;

  rep(i,n-1) {
    ans = min(ans, abs(2*s[i+1] - s[n]));
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  for(int i=0; i<N; i++){
    string t;
    cin >> t;
    sort(t.begin(),t.end());
    s[i]=t;
  }
  sort(s.begin(), s.end());
  long long cnt=0;
  long long ans=0;
  for(int i=0; i<N-1; i++){
    if(s[i]==s[i+1]){
      cnt++;
      ans+=cnt;
    }
    else{
      cnt=0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int count = 0;

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		long d = sc.nextLong();
		long dd = d * d;

		sc.nextLine();
		for(int i=0;i<n;i++){
			long p = sc.nextLong();
			long q = sc.nextLong();
			long dist = p*p+q*q;
			if(dist <= dd){
				count++;

			}

		}

		System.out.println(count);


	}

}

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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> sales = new List<int>();
            while (true)
            {
                int sum = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).Sum();
                if (sum == 0)
                    break;
                sales.Add(sum);

            }

            for (int i = 0; i < sales.Count / 5; i++)
            {
                int max = sales.GetRange(i * 5, 5).Max();
                int index = sales.GetRange(i * 5, 5).FindIndex(s => s == max);

                Console.WriteLine("{0} {1}", (char)(65 + index), max);

            }

        }
    }
}

Measured memory_bytes: 5988
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

int d[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

signed main(){
    int n,m;
    cin >> n >> m;
    bool use[10] = {};
    REP(i,m){
        int a;
        cin >> a;
        use[a] = true;
    }
    vector<int> dp(n + 1, -INF);
    int prev[n + 1];
    dp[0] = 0;
    for(int i = 0; i <= n; i++){
        for(int j = 9; j >= 1; j--){
            if(!use[j]) continue;
            if(i - d[j] < 0) continue;
            if(dp[i - d[j]] + 1 > dp[i]){
                dp[i] = dp[i - d[j]] + 1;
                prev[i] = j;
            }
        }
    }
    vector<int> ans;
    int i = n;
    while(i != 0){
        ans.emplace_back(prev[i]);
        i -= d[prev[i]];
    }
    REP(i,ans.size()){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

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

namespace ABC128A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ap = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine((ap[0] * 3 + ap[1]) / 2);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int N, K, Q;
	cin >> N >> K >> Q;
	int A[2000];
	set<int> ST;
	rep(i, N) {
		cin >> A[i];
		ST.insert(A[i]);
	}

	int saishou = 1e9;
	for (int i : ST) {
		vector<int> V, V2;
		rep(j, N) {
			if (A[j] < i) {
				if (V2.size() >= K) {
					sort(V2.begin(), V2.end());
					int kari = V2.size();
					rep(k, kari - K + 1) V.pb(V2[k]);
				}
				V2.clear();
			}
			else {
				V2.pb(A[j]);
			}
		}
		sort(V2.begin(), V2.end());
		int kari = V2.size();
		rep(k, kari - K + 1) V.pb(V2[k]);

		if (V.size() >= Q) {
			sort(V.begin(), V.end());
			saishou = min(saishou, V[Q - 1] - i);
		}
	}

	co(saishou);

	Would you please return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define stop char nyaa;cin>>nyaa;

void solve() {
	int w, h, t; cin >> w >> h >> t;
	int p; cin >> p;
	vector<pair<int, P>> v;
	rep(i, p) {
		int x, y, T; cin >> x >> y >> T;
		v.push_back({ T,{x,y} });
	}
	sort(v.begin(), v.end());
	vector<vector<bool>> b(h);
	rep(i, h) {
		b[i].resize(w, false);
		rep(j, w) {
			char tt; cin >> tt;
			if (tt == '1')b[i][j] = true;
		}
	}
	vector<vector<int>> c(h);
	rep(i, h)c[i].resize(w, 0);
	rep(i, v.size()) {
		if (v[i].first > t)break;
		P p = v[i].second;
		int x = p.first, y = p.second;
		swap(x, y);
		if (b[x][y])c[x][y]++;
	}
	int ans = 0;
	rep(i, h) {
		rep(j, w) {
			ans += c[i][j];
		}
	}
	cout << ans << endl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
		return 0;
}



Measured memory_bytes: 3236
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    num_list = i_list()
    k = i_input()

    num_list.sort()

    count = 0
    for i in range(3):
        if i == 2:
            tmp = num_list[2]
            for j in range(k):
                tmp *= 2
            count += tmp
        else:
            count += num_list[i]

    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 77176
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Rotation Matching
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  int me = m, mo = m;
  if (m & 1) me--;
  else mo--;

  for (int i = 1, j = i + mo; i < j; i++, j--)
    printf("%d %d\n", i, j);
  for (int i = mo + 2, j = i + me; i < j; i++, j--)
    printf("%d %d\n", i, j);
  return 0;
}


Measured memory_bytes: 3204
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

void debug_out() {};
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

struct C1 {
    vector<ll> v_{};
    explicit C1(vector<ll> v) : v_(move(v)){}
    explicit C1(ll N, vector<ll> r, vector<tuple<ll, ll, ll>> v) {}
    ll resolve() {
        return 0;
    }
};

int main() {
    ll N;
    cin >> N ;
    ll numOdd = (N+1) /2 ;
    cout << (double)numOdd/N << endl;
    return 0;
}


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

int main(){
   int n;
   string s;
   cin >> n >> s;
   int count=0;
   for(int i=0;i<s.length()-2;i++){
      if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
         count++;
      }
   }

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

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

int main(){

	int n,m;
	cin >> n >> m;
    if(m==0){
      cout << 1 << endl;
      return 0;
    }
	vector<vector<int>> edge(n);
	vector<int> dist(n,-1);
	int a,b;
	for(int i=0;i<m;i++){
		cin >> a >> b;a--;b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	int ans=0;
	int sum=0;
	for(int start=0;start<n;start++){
		queue<int> que;
		sum=0;
		if(dist[start]==-1) que.push(start);
		int nv;
		while(!que.empty()){
			nv=que.front();
			que.pop();

			for(auto u:edge[nv]){
				if(dist[u]==-1){
					dist[u]++;
					sum++;
					que.push(u);
				}
			}
		}
		ans=max(ans,sum);
	}
	cout << ans << endl;
}


Measured memory_bytes: 15772
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

typedef pair<string, string> P;

vector<string> prop;

int count(string& str){
  int cnt = 0;
  for(int i=0;i<str.size();i++){
    if(str[i] == ' ') cnt++;
    else break;
  }
  return cnt;
}

pair<string, string> parse(string& str){
  for(int i=0;i<str.size();i++){
    if(str[i] == ':'){
      if(i+2 >= str.size()) return P(str.substr(0, i), "");
      else return P(str.substr(0, i), str.substr(i+2));
    }
  }
}

string solve(){
  string input;
  int pre = 0;
  int pos = 0;
  while(getline(cin, input)){
    CONT:;
    int cnt = count(input);
    if(cnt != pre) continue;
    input = input.substr(cnt);
    P val = parse(input);
    if(val.first == prop[pos]){
      if(pos+1 == prop.size()){
        if(val.second == "") return "object";
        else return "string \"" + val.second + "\"";
      }else{
        pos++;
        getline(cin, input);
        int cnt = count(input);
        if(cnt <= pre) goto END;
        else{
          pre = cnt;
          goto CONT;
        }
      }
    }
  }
  END:;
  return "no such property";
}

main(){
  string input;
  getline(cin, input);
  prop.clear();
  int pre = 0;
  for(int i=1;;i++){
    if(i >= input.size()){
      prop.push_back(input.substr(pre+1));
      break;
    }
    if(input[i] == '.'){
      prop.push_back(input.substr(pre+1, i-pre-1));
      pre = i;
    }
  }
  cout << solve() << endl;
}

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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;
int n, cnt;
const int N = 24;
int a[N];

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        if (i > 0 && i < n - 1) {
            if (a[i] > a[i - 1] && a[i] < a[i + 1]) {
                ++cnt;
            } else if (a[i] < a[i - 1] && a[i] > a[i + 1]) {
                ++cnt;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3520
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n;
    int x;
    while(true){
      n = sc.nextInt();
      x = sc.nextInt();
      int count = 0;
      if(n == 0 && x == 0){
        break;
      }
      for(int i = 1; i <= n; i++){
        for(int j = i+1;j <= n; j++){
         for(int k = j + 1; k <= n; k++) {
        	 if(x == i+j+k) {
        		 count++;
        	 }
         }
        }
      }
      System.out.println(count);
    }
  }
}



Measured memory_bytes: 26816
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <map>
#include<queue>

const int INF = 1 << 28;
const long long MOD = 1000000007;
using namespace std;
using Graph = vector<vector<int>>;

template<class T> bool chmin(T &a, T &b) { if (a > b) { a = b; return 1; }return 0; }
template<class T> bool chmax(T &a, T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T, class U> using P = pair<T, U>;

vector<int> seen(50,-1);
int counter_for_dfs = 0;
void dfs(Graph &G, int v) {
	seen[v] = counter_for_dfs;
	counter_for_dfs++;
	for (auto v_next : G[v]) {
		if (seen[v_next]>=0)continue;

		dfs(G, v_next);
	}
}

void bfs(Graph &G) {
	vector<int> dist(G.size(), -1);
	queue<int> que;
	
	dist[0] = 0;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
		}
	}
	for (auto i : dist) {
		cout << i << " ";
	}
}

int counter[200005] = {};
void bfs2(Graph &G,int p,int x) {
	vector<int> dist(G.size() , -1);
	queue<int> que;
	
	dist[p] = 0;
	que.push(p);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
			counter[g] += x;
		}
	}
}
int main()
{
	int n, k;
	std::cin >> n >> k;
	std::vector<int> h;
	int rslt = 0;
	for (int i = 0; i < n; i++) {
		int a;
		std::cin >> a;
		h.push_back(a);
	}
	for (auto a : h) {
		rslt = a >= k ? rslt + 1 : rslt;
	}
	std::cout << rslt;

	return 0;
}

Measured memory_bytes: 892
use proconio::input;

#[allow(non_snake_case)]
fn main() {
    use std::f64::consts::PI;
    input! {
        A: f64,
        B: f64,
        H: f64,
        M: f64,
    }

    let t = (M / 60.0 - (H * 60.0 + M) / (12.0 * 60.0)) * 2.0 * PI;
    let ans = (A * A + B * B - 2.0 * A * B * t.cos()).sqrt();

    println!("{}", ans);
}


Measured memory_bytes: 2924
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
    long long k, a, b;
    cin >> k >> a >> b;

    if (a >= k) return cout << 1 << endl, 0;
    if (a <= b) return cout << -1 << endl, 0;

    long long t = (k - a) / (a - b) + !!((k - a) % (a - b));
    cout << 2 * t + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<numeric>

#define INF (1<<28)
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=(j);i<=(k);i++)
#define fs first
#define sc second
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

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

int main(){
	int n;
	while(cin>>n,n){
		vector<pii> v(n);
		int r=0,l=0,t=0,b=0;
		v[0] = pii(0,0);
		rep(i,n-1){
			int m,d,x,y;
			cin >> m >> d;
			x = v[m].fs + dx[d];
			y = v[m].sc + dy[d];
			v[i+1] = pii(x,y);
			r = max(r, x);
			l = min(l, x);
			t = min(t, y);
			b = max(b, y);
		}
		cout << r-l+1 << " " << b-t+1 << endl;
	}
	return 0;
}

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

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

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

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

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

int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  while(true) {
    vector<ll> b;
    b.push_back(a[0]);
    for(int i = 1; i < a.size(); ++i) if(a[i]%a[0]!=0) b.push_back(a[i]%a[0]);
    if(b.size() == 1) break;
    sort(ALL(b));
    a = b;
  }
  cout << a[0] << endl;
}


Measured memory_bytes: 2788
import scala.io.StdIn.{readInt,readLine}

object Main {
  def scan(a:Array[Int],value:Int,l:Int,r:Int):Boolean = {
    val mid = (l+r)/2
    if(a(mid) == value) true
    else if(l>=r) false
    else {
      val (new_l,new_r) = if(a(mid)<value) (mid+1,r) else (l,mid-1)
      scan(a,value,new_l,new_r)
    }
  }

  def search(a:Array[Int],value:Int) = {
    scan(a,value,0,a.length-1)
  }

  def main(args:Array[String]) = {
    readInt
    val s = readLine.split(" ").map(_.toInt).toArray
    readInt
    val t = readLine.split(" ").map(_.toInt).toArray
    println(t.count(i=> search(s,i)))
  }
}

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

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) begin(a), end(a)
#define has(a, b) (a.find(b) != a.end())
#define fora(i, n) for(int i = 0; i < n; i++)
#define forb(i, n) for(int i = 1; i <= n; i++)
#define forc(a, b) for(const auto &a : b)
#define ford(i, n) for(int i = n; i >= 0; i--)
#define maxval(t) numeric_limits<t>::max()
#define minval(t) numeric_limits<t>::min()
#define imin(a, b) a = min(a, b)
#define imax(a, b) a = max(a, b)
#define sz(x) (int)(x).size()

#define dbgs(x) #x << " = " << x
#define dbgs2(x, y) dbgs(x) << ", " << dbgs(y)
#define dbgs3(x, y, z) dbgs2(x, y) << ", " << dbgs(z)
#define dbgs4(w, x, y, z) dbgs3(w, x, y) << ", " << dbgs(z)

using ll = long long;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }

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

        int n, m;
        cin >> n >> m;
        string s, t;
        cin >> s >> t;

        ll g = gcd(n, m);
        ll l = lcm(n, m);

        bool ok = true;
        ll step = lcm(l / n, l / m);
        fora(i, l / step) {
                int pos = i * step;
                ok &= s[pos / (l / n)] == t[pos / (l / m)];
        }
        if (ok) cout << l << endl;
        else cout << -1 << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

int main() {
    long long x;

    std::cin >> x;

    if (x < 7) {
        std::cout << 1 << std::endl;
        return 0;
    }

    long long ans = x / 11;
    ans *= 2;

    x %= 11;
    if (x > 0) {
        if (x - 6 <= 0) {
            ans++;
        } else {
            ans += 2;
        }
    }

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

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

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

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	ll n, a, b;
	cin >> n >> a >> b;
	cout << n / (a + b) * a + min(a, n % (a + b)) << endl;
    
    return 0;
}


Measured memory_bytes: 3636
module solution;
import std.algorithm;
import std.conv;
import std.stdio;
import std.typecons;

int sumDigits (long a)
{
	return a.text.map !(q{a - '0'}).sum;
}

bool cmp (long a, long b)
{
	return a * b.sumDigits < b * a.sumDigits;
}

void main ()
{
	int k;
	while (readf (" %s", &k) > 0)
	{
		long cur = 1;
		long add = 1;
		foreach (i; 0..k)
		{
			writeln (cur);
			if (cmp (cur + add * 10, cur + add))
			{
				add *= 10;
			}
			cur += add;
		}
	}
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#define MOD 1000000007
int main(int argc, const char * argv[]) {
    long long n,k,ans=0;
    scanf("%lld%lld",&n,&k);
    for(long long i=k;i<=n+1;i++){
        long long min=i*(i-1)/2;
        long long max=n*(n+1)/2-(n-i)*(n-i+1)/2;
        ans+=max-min+1;
        ans%=MOD;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <algorithm>
using namespace std;
unsigned long long a,b,c,d,n;
int main(void){
    cin>>a>>b>>c>>d>>n;
    b=min(a*2,b);
    c=min(b*2,c);
    d=min(c*2,d);
    cout<<d*(n/2)+(n%2)*c<<endl;
    
}


Measured memory_bytes: 256
import math
from itertools import permutations
N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
P = list(permutations(A))
ans = 0
count = 0
for p in P:  
  count += 1
  for i in range(1,len(p)):
    ans += math.sqrt((p[i-1][0]-p[i][0])**2 + (p[i-1][1]-p[i][1])**2)        
print(ans/count)  
  


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

using namespace std;

#define ll long long
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define rep(i, a, b) for(i = a; i < b; i++)
#define repp(i, a, b) for(i = a; i > b; i--)

const int maxN = 1e5+5;
int n, l;
string s[maxN];


int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin>>n>>l;
    for(int i = 0; i < n; i++)
        cin>>s[i];

    sort(s, s+ n);

    for(int i = 0; i < n; i++)
        cout<<s[i];

    cout<<endl;


	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int m1, d1, m2, d2;
	scanf("%d%d%d%d", &m1, &d1, &m2, &d2);
	printf("%d\n", (int)m1 != m2);
}


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

ll solve(const int N, const int K)
{
    return K * std::pow(K - 1, N - 1);
}

int main(void)
{
    int N, K;
    std::cin >> N >> K;
    std::cout << solve(N, K) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int k, a, b;
    cin >> k >> a >> b;
    if (a >= b) cout << k + 1, exit(0);
    if (k < a) cout << k + 1, exit(0);
    if (a + 1 == b || a + 2 == b) cout << k + 1, exit(0);

    int ost = k + 1 - a;
    ll ans = (ll) a + (ll) ost / 2ll * (ll) (b - a);
    if (ost % 2 == 1) ans++;
    cout << ans;
    return 0;
}



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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

ll gcd(ll x, ll y) {
    if (x > y) swap(x, y);
    ll m = 1;
    while (m != 0) {
        m = y % x;
        y = x;
        x = m;
    }
    return y;
}

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> bolls(n);
    rep(i, n) cin >> bolls[i];

    if (*max_element(bolls.begin(), bolls.end()) < k) {
        cout << "IMPOSSIBLE" << endl;
        ret();
    }

    ll g = bolls.front();
    for (ll l : bolls) g = gcd(g, l);

    for (ll l : bolls) {
        if (l < k) continue;
        if ((l - k) % g == 0) {
            cout << "POSSIBLE" << endl;
            ret();
        }
    }


    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
#include <bitset>

using namespace std;
typedef long long ll;
typedef long double R;
typedef complex<R> P;
const R EPS = 1e-9;

bool near(R x1, R y1, R x2, R y2) {
    return abs(P(x1, y1)-P(x2, y2)) < EPS;
}

const int MN = 55;
R x[MN], y[MN];

int main() {
    int n;
    cin >> n;
    if (n % 2) {
        cout << "NA" << endl;
        return 0;
    }
    R X = 0, Y = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        X += x[i]; Y += y[i];
    }
    X /= n;
    Y /= n;
    for (int i = 0; i < n; i++) {
        if (!near(X*2, Y*2, x[i]+x[(i+n/2)%n], y[i]+y[(i+n/2)%n])) {
            cout << "NA" << endl;
            return 0;
        }
    }
    printf("%Lf %Lf\n", X, Y);
    return 0;
}

Measured memory_bytes: 1248
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))

lli n;

lli idx[105][100];
lli dp[105][100];

lli rec(lli nb,lli ub,lli sb,lli r,int d,int isodd){
	//printf("q :: %lld %lld %lld %lld %d\n",nb,ub,sb,r,d);
	if(nb==0 && r==0){
		if(isodd)return 10;
		else return 1;
	}
	if(r>nb*20 || r<nb*(-20))return 0;
	
	int x=0;
	for(;;){
		if(dp[d][x]<0)break;
		if(idx[d][x]==r){
			return dp[d][x];
		}
		x++;
	}
	
	lli res=0;
	reg(i,-9,9){
		if(d==0 && i<0)continue;
		lli ns = rec(nb-((ub==sb)?ub:(ub+sb)),ub/10,sb*10,r-nb*i,d+1,isodd);
		int pan=10-abs(i);
		if(d==0 && i>=0)pan--;
		res += ns * pan;
	}
	
	idx[d][x]=r;
	dp[d][x]=res;
	//printf("%lld %lld %lld %lld %d :: %lld\n",nb,ub,sb,r,d,res);
	return res;
}

lli dn(int k){
	memst(dp,-1);
	lli ub=1;
	rep(i,k){
		ub*=10;
	}
	lli nb=ub*10-1,sb=9;
	ub*=9;
	
	lli res=rec(nb,ub,sb,n,0,k%2);
	//printf("%d %lld : %lld\n",k,nb,res);
	return res;
}

int main(void){
	scanf("%lld",&n);
	lli ans=0;
	rep(i,1000){
		lli b=1;
		rep(j,(i+3)/2)b*=10;
		b--;
		if(b>n*10)break;
		ans+=dn(i);
	}
	printf("%lld\n",ans);
	return 0;
}






Measured memory_bytes: 384
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
int main() {
  IOS;
  ll n, a, b;
  cin >> n >> a >> b;
  if (n == 1) {
    cout << (a == b) << endl;
  } else if (a <= b) {
    cout << b * (n - 2) + a + b - (a * (n - 2) + a + b) + 1 << endl;
  } else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 3652