akhauriyash/Code-Regression huggingface dataset:
import math


def make_stu(p1, p2):
    s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
    t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
    u = [s[0] + (t[0] - s[0]) / 2 - math.sqrt(3) * (t[1] - s[1]) / 2,
         s[1] + (t[1] - s[1]) / 2 + math.sqrt(3) * (t[0] - s[0]) / 2]
    return s, t, u


def koch_curve(n, p1, p2):
    if n >= 1:
        s, t, u = make_stu(p1, p2)
        if n == 1:
            print(s[0], s[1])
            print(u[0], u[1])
            print(t[0], t[1])
        else:
            koch_curve(n - 1, p1, s)
            print(s[0], s[1])
            koch_curve(n - 1, s, u)
            print(u[0], u[1])
            koch_curve(n - 1, u, t)
            print(t[0], t[1])
            koch_curve(n - 1, t, p2)

n = int(input())

print(0.0, 0.0)
koch_curve(n, [0.0, 0.0], [100.0, 0.0])
print(100.0, 0.0)


Measured memory_bytes: 5764
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using ti3 = tuple<int, int, int>;
using vti3 = vector<ti3>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
template<class T> void cmin(T &a, const T&b) { if (a > b)a = b; }
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
int main() {
	string s;
	cin >> s;
	rep(i, s.size() - 1) {
		int l = 0;
		if (s[i] == s[i + 1])l = 2;
		else if (i!=s.size()-2&&s[i] == s[i + 2])l = 3;
		if (l) {
			cout << i + 1 << " " << i + l << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll  long long 
#define mp make_pair
#define pb push_back
#define f first
#define s second
const ll mod=998244353;
const ll N=2e5+5;
unordered_map<ll,vector<ll>> adj;
vector<ll> vis(300005,0);
vector<ll> p(100005,0);
ll c[100005];
ll cnt;
ll n;
void dfs(ll node)
{
  if(vis[node])
    return;
  vis[node]=1;
  cnt++;
  for(auto i:adj[node])
    {
      dfs(i);
    }
}
struct range{
  ll l;
  ll r;
  ll a;
};
bool cmp(range& p1,range& p2)
{
    if(p1.a==p2.a)
      return p1.l<p2.l;
    return p1.a<p2.a;
}
int main()
{
  string s="ACL";
  ll n;
  cin>>n;
  string ans;
  ll i;
  for(i=0;i<n;i++)
  {
    ans+=s;
  }
  cout<<ans;
}

Measured memory_bytes: 6180
#include<stdio.h>

int main (void)
{
	int input1,input2,input3,input4,input5;
	
	scanf("%d %d %d %d %d",&input1,&input2,&input3,&input4,&input5);
	if(input3 - input5 < 0 || input3 + input5 > input1)
	{
		printf("No\n");
	}
	else if( input4 - input5 < 0 || input4 + input5 > input2 )
	{
		printf("No\n");
	}
	else
	{
		printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/

lli gcd(lli a, lli b, lli& x, lli& y) {
    x = 1, y = 0;
    lli x1 = 0, y1 = 1, a1 = a, b1 = b;
    while (b1) {
        lli q = a1 / b1;
        tie(x, x1) = make_tuple(x1, x - q * x1);
        tie(y, y1) = make_tuple(y1, y - q * y1);
        tie(a1, b1) = make_tuple(b1, a1 - q * b1);
    }
    return a1;
}
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  lli n;
  cin>>n;
  if(n==2){
      cout<<3<<endl;
      return 0;
  }
  if(n==3){
      cout<<2<<endl;
      return 0;
  }
  if(n==4){
      cout<<7<<endl;
      return 0;
  }
  if((n&n-1)==0){
      cout<<2*n-1<<endl;
      return 0;
  }
  lli ans=n-1;
  for(lli i=2;i*i<=2*n;i++){
      if(2*n%i) continue;
      if(__gcd(i,2*n/i)!=1) continue;
      lli x,y;
      gcd(i,2*n/i,x,y);
      lli ax=i*x   ,by=2*n/i*y;
      ax=abs(ax);
      by=abs(by);
      //cout<<ax<<" "<<by<<endl;
       if(ax+1==by  || ax-1==by){
           ans=min(ans,min(abs(ax),abs(by)));
           //return 0;
       } 
  }
  cout<<ans<<endl;
  //cout<<endl;
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
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 >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;

void solve()
{
	string s; cin >> s;
    set<char> alp;
    rep(i ,sz(s))alp.insert(s[i]);
    string ans;
    if(sz(alp)%2==1)ans = "No";
    else if(sz(alp) == 4)ans = "Yes";
    else
    {
        if((alp.find('N')!=alp.end() && alp.find('S')!=alp.end())||
        (alp.find('E')!=alp.end() && alp.find('W')!=alp.end()))
            ans = "Yes";
        else ans = "No";
    }
    cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////

int main()
{
    int N;
    io >> N;

    int kyu = 10 - (N / 200);
    io << kyu << BR;
}

Measured memory_bytes: 3824
import math


swap_count = 0


def main():
  num = int(input())
  elements = []
  for i in range(0, num):
    elements.append(int(input()))

  # Get intervals
  interval = 1
  intervals = [interval]
  while True:
    interval = int_f(interval)
    if interval > num:
      break
    intervals.insert(0, math.ceil(interval))

  for interval in intervals:
    insertion_sort(elements, num, interval)

  print(len(intervals))
  print(' '.join([str(interval) for interval in intervals]))
  print(swap_count)
  for val in elements:
    print(val)


def int_f(x):
  return 2.25 * x + 1


def insertion_sort(elements, num, interval=1):
  global swap_count

  i = interval
  while i < num:
    j = i
    while interval <= j:
      if elements[j - interval] <= elements[j]:
        break

      elements[j - interval], elements[j] = elements[j], elements[j - interval]
      swap_count += 1
      j -= interval
    i += 1


if __name__ == '__main__':
  main()

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

int main() {
	vector<char> o(4);
	string p;
	rep(i, 4) {
		cin >> o[i];
		cout << o[i];
	}
	cout << ' ';
	cin >> p;
	cout << p << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	//Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));
	
	public static void main(String[] args) {
		int a=scan.nextInt();
		int b[]=setArray(a);
		int max=0;
		int cnt=0;
		for(int i=a-1;i>0;i--) {
			if(b[i]<=b[i-1])cnt++;
			else cnt=0;
			max=max(max,cnt);
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 51048
#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> pii;
#define INF 0x3f3f3f3f
const int N = 100010;
int mod = 1000000007;
char s[22];
int main()
{
	//freopen("in.txt", "r", stdin);
	int T, n, k;
	while (~scanf("%d", &n))
	{
		int rec[256] = {0};
		for (int i = 0; i < n; i++)
		{
			scanf("%s", s);
			rec[s[0]]++;
		}
		char cs[] = "MARCH";
		ll ans = 0;
		for (int i = 0; i < 32; i++)
		{
			int cnt = 0;
			for (int j = 0; j < 5; j++)
				cnt += (i>>j)&1;
			if (cnt == 3)
			{
				ll t = 1;
				for (int j = 0; j < 5; j++)
					if ((i>>j)&1)
						t *= rec[cs[j]];
				ans += t;
			}
		}
		cout<<ans<<endl;
	}
   	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

kill = 0
for x in range(len(B)):
    next_town_kill = 0
    same_town_kill = min(B[x], A[x])
    kill += same_town_kill

    remain = B[x] - A[x]
    if remain > 0:
        next_town_kill = min(remain, A[x + 1])
        kill += next_town_kill
        A[x + 1] = max(A[x + 1] - remain, 0)
print(kill)


Measured memory_bytes: 82020
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll n;
    string s;
    cin >> n >> s;
    Eunique(s);
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 512
// Problem : A - Nickname
// Contest : AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest 2020
// URL : https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	string s;
	cin >> s;
	for(int i=0;i<3;++i)
	{
		cout << s[i];
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 3656
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	int ans = 0;//最小値
	int G = 0;
	int P = 0;
	for(int i=0;i<size;++i){
		if( P+1 <= G ){
			//Pだす
			++P;
			if( str[i] == 'g' ){
				ans += 1;
			}
		}else{//gだす
			++G;
			if( str[i] == 'p' ){
				ans -= 1;
			}
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, L[201],sum;
int main() {
	scanf("%d",&n);
	for(int i=0;i<2*n;i++)
		scanf("%d",L+i);
	sort(L,L+2*n);
	for(int i=0;i<n;i++)
		sum+=L[2*i];
	printf("%d\n",sum);
}

Measured memory_bytes: 128
input_line1 = map(int,raw_input().split(" "))
#input_line2 = map(int,raw_input().split(" "))
a = input_line1[0]
b = input_line1[1]
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
	print "Possible"
else:
	print "Impossible"

Measured memory_bytes: 2568
import Control.Monad (replicateM)
import Data.List (sort)

main = do
    n <- readLn
    if n == 0 then return () else do
        as <- replicateM n readLn
        let
            (a,b) = game as (filter (not . (`elem` as)) [1..2*n])
        print a
        print b
        main

game :: [Int] -> [Int] -> (Int,Int)
game as bs = game' 'A' 0 (sort as) (sort bs) [] []
    where
    game' 'A' _ as [] as' [] = (0, (length as) + (length as'))
    game' 'B' _ [] bs [] bs' = ((length bs) + (length bs'), 0)
    game' 'A' _ [] bs as' bs' = game' 'B' 0 (reset [] as') (reset bs bs') [] []
    game' 'B' _ as [] as' bs' = game' 'A' 0 (reset as as') (reset [] bs') [] []
    game' 'A' l (a:as) bs as' bs'
        | a > l = game' 'B' a as bs as' bs'
        | otherwise = game' 'A' l as bs (a:as') bs'
    game' 'B' l as (b:bs) as' bs'
        | b > l = game' 'A' b as bs as' bs'
        | otherwise = game' 'B' l as bs as' (b:bs')

    reset xs xs' = (reverse xs') ++ xs

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

using namespace std;

const int N = 1e5 + 7;
int n;

int main()
{

        ios_base::sync_with_stdio(0);
        cin.tie(0);
        //freopen("in.in", "r", stdin);

        cin >> n; 
        if(n>=30){
                cout<<"Yes" ; 
        }
        else {
                cout<<"No" ; 
        }



        return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
 
int main(){
    int i, j;
    for(i = 1; i <=9; i++){
        for(j = 1; j <=9; j++){
            cout << i << "x" << j << "=" << i*j << endl;
        }
    }
 
    return 0;
}

Measured memory_bytes: 2992
N = int(input())
A = input()
B = input()
C = input()

list_word = [[] for j in range(3)]

list_word[0] = list(A)
list_word[1] = list(B)
list_word[2] = list(C)

word_length = N

sum_char_change = 0
for idx in range(N):
    A_char = list_word[0][idx]
    B_char = list_word[1][idx]
    C_char = list_word[2][idx]

    sum_char_change += len(set([A_char, B_char, C_char]))-1

    #print([A_char, B_char, C_char])

print(sum_char_change)



Measured memory_bytes: 3064
N, W = map(int, input().split())
Items = [tuple(map(int, input().split())) for _ in range(N)]
from collections import defaultdict as dd
Bag = dd(lambda:0)
Bag[0] = 0
for w,v in Items:
    temp = [(key+w,Bag[key]+v) for key in Bag if key + w <= W]
    for key,value in temp:
        Bag[key] = max(Bag[key],value)
ans = max(Bag.values())
print(ans)

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

// int/long:            -2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

/*
int     gcd(int A, int B) {
        while (0!=B) {
                A %=B;
                swap(A, B);
        }
        return A;
}
*/

#define MOD 1000000007

int     main() {
        int a, b, c;
        cin >>a >>b >>c;
        if ((a<b)&&(b<c))
                cout <<"Yes" <<endl;
        else
                cout <<"No" <<endl;
        return 0;
}


Measured memory_bytes: 3112
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std ;

char s[5];

int main ()
{
	scanf("%s",s);
	if ( strlen(s)==2 ) puts(s);
	else swap(s[0],s[2]),puts(s);
	return 0 ;
}

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

int main (){
	int n, z, w;
	cin>>n>>z>>w;
	if(n>2){
		for(int i = 0; i<n-2; i++){
			int temp;
			cin>>temp;
		}
		int l1, l;
		cin>>l1>>l;
		int ans = abs(l1-l);
		if(abs(l-w) > abs(l1-l)) ans = abs(l-w);
		cout<<ans<<endl;
	}
	else{
		int k;
		cin>>k;
		cout<<abs(k-w)<<endl;
	}
	return 0;
}

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

class B
{
	static void Main()
	{
		var M = 1000000007;
		var n = int.Parse(Console.ReadLine());
		var c = new int[n].Select(_ => int.Parse(Console.ReadLine())).ToArray();

		var map = c.Select((x, i) => (x, i)).GroupBy(_ => _.x, _ => _.i).ToDictionary(g => g.Key, g => new Queue<int>(g));

		var dp = new long[n];
		dp[0] = 1;

		for (int i = 0; i < n - 1; i++)
		{
			map[c[i]].Dequeue();

			dp[i + 1] = (dp[i + 1] + dp[i]) % M;
			if (map[c[i]].TryPeek(out var j) && j - i >= 2)
				dp[j] = (dp[j] + dp[i]) % M;
		}

		Console.WriteLine(dp[^1]);
	}
}


Measured memory_bytes: 75980
#include<stdio.h>
int main(void){
    int a, b;
    scanf("%d %d", &a, &b);
    if(a>b){printf("a > b\n");}
    if(a<b){printf("a < b\n");}
    if(a==b){printf("a == b\n");}
    return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    string s;
    cin >> s;
    int a = 0;
    rep(i, s.size())
    {
        a += s[i] - '0';
        a %= 9;
    }

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

    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define res register int
using namespace std;
const int maxn = 505;
int h,w;
char mp[maxn][maxn];
inline int read(){
	res X=0,w=0;register char ch=0;
	while(!isdigit(ch)){w|ch=='-';ch=getchar();}
	while(isdigit(ch)){X=(X<<1)+(X<<3)+(ch^48);ch=getchar();}
	return w?-X:X;
}
int main() {
    h=read(),w=read();
    for (res i=0; i<h; i++)
      scanf("%s",mp[i]);
    for (res i=0; i<h; i++) {
        for (res j=0; j<w; j++) {
            if (j == 0) putchar('.');
            else if (!(i & 1)) putchar('#');
            else if ((i & 1) && j == w-1) putchar('#');
            else if (mp[i][j] == '#') putchar('#');
            else putchar('.');
        }
        puts("");
    }
    puts("");
    for (res i=0; i<h; i++) {
        for (res j=0; j<w; j++) {
            if (j == w-1) putchar('.');
            else if (i & 1) putchar('#');
            else if (!(i & 1) && j == 0) putchar('#');
            else if (mp[i][j] == '#') putchar('#');
            else putchar('.');
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1024
var sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var triangles = (sample_input.trim()).split("\n");
triangles.shift();
triangles.forEach(function(triangle){
  var sides = triangle.split(" ").map(Number);
  sides.sort( function(a,b) { return a-b; } );
  var is_right="";
  is_right=(sides[2]*sides[2]==sides[0]*sides[0]+sides[1]*sides[1]) ? "YES" : "NO";
  console.log(is_right);
});

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

template <typename T> vector<vector<T>> make_vector_2d(int n, int m, T initialValue) {
    auto r = vector<vector<T>>(n);
    for (int i = 0; i < n; i++) r[i] = vector<T>(m, initialValue);
    return r;
}

int main(void) {

    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n, 0);
    auto a = make_vector_2d(n, m, 0);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) cin >> a[i][j];
    }

    ll minPrice = LLONG_MAX;
    vector<int> understanding(m, 0);
    for (int bit = 0; bit < (1 << n); bit++) {
        for (int j = 0; j < m; j++) understanding[j] = 0;
        ll totalPrice = 0;
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) { //もし、i冊目の本を買うなら理解度を足す。
                for (int j = 0; j < m; j++) understanding[j] += a[i][j];
                totalPrice += c[i];
            }
        }
        bool masterAllAlg = true;
        for (int j = 0; j < m; j++) {
            if (understanding[j] < x) {
                masterAllAlg = false;
                break;
            }
        }
        if (masterAllAlg) {
            minPrice = min(minPrice, totalPrice);
        }
    }

    if (minPrice == LLONG_MAX) {
        cout << -1 << endl;
    }
    else {
        cout << minPrice << endl;
    }

    return 0;

}


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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;

    int res = 0;
    for (int i = 0; i < n - 2; i++) {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
            res++;
        }
    }

    cout << res << endl;
}


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

int main()
{
	uint32_t s, n, f;
	map<uint32_t, bool> m;

	cin >> s;
	n = 1;
	f = s;

	while (true)
	{
		m.insert(make_pair(f, true));
		n++;
		f = (f % 2) ? 3 * f + 1 : f / 2;
		auto itr = m.find(f);
		if (itr != m.end())
		{
			break;
		}
	}

	cout << n;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#include <bitset>
#include <set>

using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define repe_r(i,s,n)for(int i = n;i>=s;i--)

ll a[100001] = {};

int main() {
	ll n; cin >> n;
	repe(i, 1, n) cin >> a[i];

	multiset<ll> s;
	for (ll i = 1; i <= n; ++i) {
		auto itr = s.lower_bound(a[i]);
		if (itr != s.begin()) {
			s.erase(--itr);
		}
		s.insert(a[i]);
	}
	cout << s.size() << endl;
	return 0;
}

Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<map>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<iomanip>
using namespace std;
const int maxn =1e5+4;
const int inf=1e9;
typedef long long ll;
const ll mod=998244353;
int k,dis[10];
bool check(int t){
	while(t){
		for(int i=1;i<=k;i++)
			if(t%10==dis[i])
				return false;
			t/=10;
	}
	return true;
}
int main(){
	int n;
	while(cin>>n>>k){
		int i;
		for(i=1;i<=k;i++)
			scanf("%d",&dis[i]);
		for(i=n;;i++){
			if(check(i)){
				cout<<i<<endl;
				break;
			}
		}
	}
}

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

ll a[300000];
int main() {
	ll n; scanf("%lld", &n);
	rep(i, n) {
		scanf("%lld", &a[i + 1]);
		a[i + 1 + n] = a[i + 1];
	}
	for (ll i = 1; i <= 2 * n; i++)
		a[i] += a[i - 1];
	ll s = 0, g = a[n];
	while (s != g) {
		ll t = (s + g) / 2;
		if (g - s == 1)t = g;
		bool flag = false;
		rep(i, n) {
			ll j = lower_bound(a + i, a + i + n + 1, a[i] + t) - a;
			if (j == n + i + 1)continue;
			ll k = lower_bound(a + j, a + i + n + 1, a[j] + t) - a;
			if (a[j] - a[i] >= t&&a[k] - a[j] >= t&&a[i + n] - a[k] >= t) {
				flag = true;
				break;
			}
		}
		if (flag)s = t;
		else g = t - 1;
	}
	printf("%lld\n", s);
}

Measured memory_bytes: 4780
S = input()
T = input()

alpha = "abcdefghijklmnopqrstuvwxyz" 

d = {}
for i in alpha:
    d[i] = None

for i in range(len(T)):
    if(d[T[i]] == None):
        if((S[i] in d.values()) == True):
            print("No")
            exit()
        d[T[i]] = S[i]
    elif(d[T[i]] != S[i]):
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3632
import numpy as np

H,W = map(int,input().split())
# 周りに壁を、0,1化、壁を0で持つ
grid = np.zeros((H+2,W+2),dtype=np.bool)
grid[1:-1,1:-1] = (np.array([list(input()) for _ in range(H)]) == '.')

# x軸方向の集計
def F(transpose):
  x = grid
  if transpose:
    x = (x.T).copy()
  x = np.ravel(x) # to 1D array
  L = len(x)
  
  left_zero = -np.arange(L) # 左の壁のindexの-1倍
  left_zero[x] = 0
  np.minimum.accumulate(left_zero, out=left_zero)
  
  right_zero = np.arange(L) # 逆順ソートした上で左の壁のindex
  right_zero[x[::-1]] = 0
  np.maximum.accumulate(right_zero, out=right_zero)
  
  y = left_zero
  y += L-right_zero[::-1]
  
  return y.reshape(grid.T.shape).T if transpose else y.reshape(grid.shape)
  
answer = (F(False) + F(True)).max()-5
print(answer)


Measured memory_bytes: 161332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
const int INF = 2e9;

int main(){
    int n, m;
    cin >> n >> m;
    vector<bool> a(n+1, false);
    vector<ll> dp(n+1);
    for(int i=0; i<m; i++){
        int sc;
        cin >> sc;
        a[sc] = true;
    }
    dp[0] = 1;
    if(!a[1]) dp[1] = 1;
    for(int i=2; i<=n; i++){
        if(!a[i]) dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= MOD;
    }
    cout << dp[n] << endl;
}

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	for (char c : s) {
		if (c == '1') cout << '9';
		else cout << '1';
	}
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  int y, m, d;
  char c0, c1;
  cin >> y >> c0 >> m >> c1 >> d;
  cout << (m <= 4 ? "Heisei" : "TBD");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while (1) {
		c = c - b;
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		a = a - d;
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	return 0;
}



Measured memory_bytes: 3592
#include <stdio.h>

int main(void) {
  long a = 0;
  long b = 0;

  long d = 0;
  long r = 0;
  double f = 0;

  scanf("%ld", &a);
  scanf("%ld", &b);

  d = a / b;
  r = a % b;
  f = ((double) a) / ((double) b);

  printf("%ld %ld %f\n", d, r, f);
  
  return 0;
}

Measured memory_bytes: 636
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* include {{{ */
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <iostream>
#include <algorithm>

using namespace std;

/*  }}} */
/* cpp template {{{*/


#define endl '\n'
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;      // ??§?¨?????????????double???long double?????????
typedef long long ll;
typedef long double lb;
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W){return (y >= 0 && x >= 0 && y < H && x < W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* ?????° */
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


/* }}} */

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // ???????????????
  return a1 + d1/d2 * (a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

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

  int x = in();
  
  for (int i = 0; i < x; i++){
    D a1, a2, b1, b2, c1, c2;
    cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
    P p = circumcenter( P(a1, a2), P(b1, b2), P(c1, c2));
    D r = sqrt(pow(a1 - p.X, 2) + pow(a2 - p.Y, 2));
    printf("%.3f %.3f %.3f", p.X, p.Y, r);

    cout << endl;
  }
  return (0);
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define INF 1000000007
#define SEP " "

int     main()
{
	int x, n;
	cin >> x >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	if (!binary_search(p.begin(), p.end(), x))
	{
		cout << x << endl;
		return (0);
	}
	int up = x, down = x;
	while (1)
	{
		if (!binary_search(p.begin(), p.end(), --down))
		{
			cout << down << endl;
			break ;
		}
		if (!binary_search(p.begin(), p.end(), ++up))
		{
			cout << up << endl;
			break ;
		}
	}
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  bool answer=false;
  string h="NO";
  cin >> a >> b >> c;
  if(a==7 && b==5 && c==5){
    answer=true;
  }
  else if(a==5 && b==5 && c==7) {
    answer=true;
  }
  else if(a==5 && c==5 && b==7){
    answer=true;
  }
  if (answer){
    h="YES";
  }
  cout << h << endl;
}

Measured memory_bytes: 256
S = gets.chomp
T = gets.chomp

def placeInfo(str)
	count = Hash.new{[]}
	str.length.times do |i|
		count[str[i]] = count[str[i]].push(i)
	end
	return count.values
end

if placeInfo(S) == placeInfo(T)
	print("Yes\n")
else
	print("No\n")
end

Measured memory_bytes: 6972
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code
vector< vi > g;
vi ans, v;
int n, id;

void solve(int node, vector<int>& lis_vec, int lis_vec_sz, int parent) {
    // podem acontecer duas coisas
    vector<int>::iterator it = lower_bound(all(lis_vec), v[node]);
    if(it == lis_vec.end()) {
        lis_vec.push_back(v[node]);
        lis_vec_sz++;
        ans[node] = lis_vec_sz; 
        for(const int& nei : g[node]) {
            if(nei != parent) {
                solve(nei, lis_vec, lis_vec_sz, node);
            }
        }
        lis_vec.pop_back();
        lis_vec_sz--;
    }
    else {
        int fid = (int) (it - lis_vec.begin());
        int fode = lis_vec[fid];
        lis_vec[fid] = v[node]; 
        ans[node] = lis_vec_sz;
        for(const int& nei : g[node]) {
            if(nei != parent) {
                solve(nei, lis_vec, lis_vec_sz, node);
            }
        }
        lis_vec[fid] = fode;
    }
}

int main() 
{
    buff();
    cin >> n;
    v.resize(n); ans.resize(n); g.resize(n);
    for(int i = 0; i < n; ++i) cin >> v[i];
    rep(i, 0, n - 1) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u); 
    }
    vector<int> v_lis;
    solve(0, v_lis, 0, -1);
    for(int i = 0; i < n; ++i) {
        cout << ans[i] << '\n';
    }

    return 0;
}



Measured memory_bytes: 29980
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vector<vector<int>> edge(N);
    REP(i,M){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    REP(i,N){
        cout << edge[i].size() << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int arr[30],n,sum=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&arr[i]);
  }
  sort(arr,arr+n);
  arr[n-1]=arr[n-1]/2;
   for(int i=0;i<n;i++){
    sum+=arr[i];
  }
  printf("%d\n",sum);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    // dp, ApplePen
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) {
        cin >> A[i];
        --A[i];
    }
    ll ans = 0;
    ll temp = 0;
    map<int, int> mp;
    vector<int> cum(N);
    mp[0] = 1;
    rep(i, N) {
        if (i == K-1) mp[0]--;
        if (i >= K) mp[cum[i-K]]--;
        temp += A[i];
        temp %= K;
        cum[i] = temp;
        ans += mp[temp]++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 14308
#include<bits/stdc++.h>
#define sc(v) v.size()
#define eb push_back
#define pb pop_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define TC() int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define mk make_pair
#define fi first
#define se second
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

const int N = 1e5 + 5;
int ar[N];
int main()
{
	int n;
	cin>>n;
	for (int i = 0;i < n;i++) cin>>ar[i];
	multiset<int> st;
	int ans = 0;
	for (int i = 0;i < n;i++) {
		auto it = st.lower_bound(ar[i]);
		if (((int)st.size() == 0) || it == st.begin()) {
			ans++;
		} else {
			it--;
			st.erase(it);
		}
		st.insert(ar[i]);
	}
	cout<<ans;
    return 0;
}


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

long long GetLeastCommonMultiple(long long a, long long b)
{
	long long m = a;
	long long n = b;
	long long temp;
	
	while (m % n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}	
	return a * b / n;
}

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int tt = sc.nextInt();
        int tk = sc.nextInt();
        int at = sc.nextInt();
        int ak = sc.nextInt();
        while(true) {
            at -= tk;
            if(at <= 0) {
                System.out.println("Yes");
                return;
            }
            tt -= ak;
            if(tt <= 0) {
                System.out.println("No");
                return;
            }
        }
    }
}

Measured memory_bytes: 26996
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
typedef long long ll;

int main() {
	ll N, M;
	ll *a, *b, *c, *d;
	cin >> N >> M;
	a = (ll*)malloc(sizeof(ll)*N);
	b = (ll*)malloc(sizeof(ll)*N);
	c = (ll*)malloc(sizeof(ll)*M);
	d = (ll*)malloc(sizeof(ll)*M);
	for (ll i = 0;i < N;i++)cin >> a[i] >> b[i];
	for (ll i = 0;i < M;i++)cin >> c[i] >> d[i];
	
	for (ll i = 0;i < N;i++) {
		ll num = 1,min = 200000000;
       for (ll j = 0;j < M;j++) {
		ll dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
		if (min > dist) {
			min = dist;
			num = j + 1;
		}
	}
	   cout << num << endl;
}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }






int main(int argc, char* argv[])
{
	for (;;) {
		int N, A, B, C, D;
		cin >> N >> A >> B >> C >> D;
		A--, B--, C--, D--;
		if (cin.fail()) break;

		string S;
		cin >> S;
		S += "##";

		auto check = [=](int A, int C) {
			while (A < C) {
				if (S[A + 1] != '#') A += 1;
				else if (S[A + 2] != '#') A += 2;
				else return false;
			}
			return true;
		};
		if (check(A, C) && check(B, D)) {
			if (C < D) {
				cout << "Yes" << endl;
			} else if (S.substr(B - 1, (D + 1) - (B - 1) + 1).find("...") != string::npos) {
				cout << "Yes" << endl;
			} else {
				cout << "No" << endl;
			}
		} else {
			cout << "No" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
int q[200000];
main(){
    int n,i,c,k,mx=0;
    cin>>n;
    for (i=0;i<n;++i){
        cin>>k;
        q[k]++;
    }
    for (i=0;i<200000;++i){
        mx=max(mx,q[i]+q[i-1]+q[i+1]);
    }
    cout <<mx;
}


Measured memory_bytes: 1024
/*input
2 7
2 3
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,K;cin>>N>>K;
	vector<int> a(N);
	for(int i=0;i<N;i++) cin>>a[i];
	vector<int> dp(K+1);
	dp[0]=0;
	for(int i=1;i<=K;i++)
	{
		int ls = 0;
		for(int j=0;j<N;j++)
		{
			if(i-a[j]>=0 && dp[i-a[j]]==0) 
			{
				ls=1;
				break;
			} 
		} 
		dp[i]=ls;
	}

	cout<<(dp[K]?"First":"Second");
	return 0;
}


Measured memory_bytes: 3688
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		long T[]=new long[N];
		int z=0,s=0,t=0;
		long y=0,x=0,w=0;
		while(z<N){
			T[z]=stdIn.nextLong();
			z++;
		}z=0;
		Arrays.sort(T);
		while(z<N-1){
			y=T[z];x=T[z+1];
			while(true){
				if(x==y){
					s=2;
					break;
				}
				if(x>y){
					s=0;
					if(x%y==0)
						break;
					else{
						w=y;
						y=x%y;
						x=w;
					}
				}
				if(y>x){
					s=1;
					if(y%x==0)
						break;
					else{
						w=x;
						x=y%x;
						y=w;
					}
				}
			}
			if(s==0)
				T[z+1]=T[z]/y*T[z+1];
			if(s==1)
				T[z+1]=T[z]/x*T[z+1];
			if(s==2)
				t=0;
			z++;
		}
		System.out.println(T[z]);
	}
}


Measured memory_bytes: 25044
#include <iostream>
#include <cstdlib>
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 long long INF = 1LL << 60;

int n, k;
long long h[100100];
long long dp[100100];

long long rec(int i) {
    if (dp[i] < INF) return dp[i];

    if (i == 0) return 0;

    long long res = INF;

    for (int j = 1; j <= k; j++) {
        if (j > i) break;
        chmin(res, rec(i - j) + abs(h[i] - h[i - j]));
    }

    return dp[i] = res;
}

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> h[i];

    for (int i = 0; i < 100100; i++) dp[i] = INF;

    cout << rec(n - 1) << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <fstream>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N+1);
    a[0] = 0;
    for (int i = 1; i <= N; ++i)cin >> a[i];
    vector<int> b(N+1);
    for (int i = 1; i <= N; ++i) {
        b[a[i]] = i;
    }
    for (int i = 1; i <= N; ++i) {
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1664