akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<algorithm>
#include<cassert>
#include<cmath>
using namespace std;

class Parsing
{
private:
  string parse;
  int pos;
  int size;
  int x;
public:

  Parsing(string parse = "",int x = 0):parse(parse),pos(0),x(x),size(0){}

  int StringToInt(string v)
  {
    int ret = 0;
    for(int i=0;i<v.size();i++)
      ret += (v[i]-'0')*(int)pow(10.0,v.size()-i-1);
    return ret;
  }

  string getCnt()
  {
    assert('0' <= parse[pos] && parse[pos] <= '9');
    string v;
    while('0' <= parse[pos] && parse[pos] <= '9') 
      v += parse[pos++];
    return v;  
  }

  int getCntInt()
  {
    return StringToInt(getCnt());
  }

  string decode()
  {
    assert('0' <= parse[pos] && parse[pos] <= '9');
    int power = getCntInt();
    if(parse[pos] == '(')
      pos++;
    else 
      {
	string mes,ret;
	while('A' <= parse[pos] && parse[pos] <= 'Z')	
	  mes += parse[pos++];
	
	for(int i=0;i<power;i++)
	  {
	    ret += mes;
	    if(ret.size() >= x)
	      break;
	  }
	return ret;	  
      }
    string message;
    while(('0' <= parse[pos] && parse[pos] <= '9') || ('A' <= parse[pos] && parse[pos] <= 'Z') )
      {
	if('0' <= parse[pos] && parse[pos] <= '9')
	  message += decode();
	else if('A' <= parse[pos] && parse[pos] <= 'Z')
	  message += parse[pos++];
      }  
    
    if(parse[pos] == ')')
      pos++;
    
    string ret;
    for(int i=0;i<power;i++)
      {
	ret += message,size += message.size();
	if(ret.size() >= x)
	  break;
      }
    return ret;
  }

  string exp()
  {
    string ret;
    for(;pos<parse.size();)
      {
	if('0' <= parse[pos] && parse[pos] <= '9')
	  ret += decode();
	else
	  ret += parse[pos++],size++;
	if(ret.size() >= x)
	  break;
      }
    return ret;
  }

  int getSize()
  {
    return size;
  }

};

int main()
{
  string Genome;  
  int pos;
  while(cin >> Genome >> pos, Genome != "0" || pos != 0)
    {
      Parsing par = Parsing(Genome,pos+1);
      string message = par.exp();
      message.size() <= pos?cout << 0 << endl:cout << message[pos] << endl;
    }
  return 0;
}

Measured memory_bytes: 6852
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define test int t; cin>>t; while(t--)
#define loop(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
typedef long long int ll;
#define MAX 100000
#define debug(i) cout<<i<"\n"
#define f(t1,t2) min(max(a[t1],a[t2]) , max(b[t1],b[t2]));

void print_arr(int a[] , int n){
	loop(i,n){
		cout<<a[i]<<" ";
	}
	cout<<"\n";
}

void print_arr(ll a[] , int n){
	loop(i,n){
		cout<<a[i]<<" ";
	}
	cout<<"\n";
}

void init(int a[] , int n){
	loop(i,n) a[i]=0;
}

void visit(vector<vector<int> >& g, int i , vector<int>& vis){
    vis[i] = 1;
    for(int j=0;j<g[i].size();j++){
        if(vis[g[i][j]] == 0)
            visit(g,g[i][j],vis);
    }
}

int dfs(vector<vector <int> >& g, int n){
    int color = 0;
    vector<int> vis(n,0);
    for(int i=0;i<n;i++){
        if(vis[i] == 0){
            ++color;
            //cout<<i<<" "<<color<<"\n";
            visit(g,i,vis);
        }
    }
    return color;
}

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> em;
    vector<vector <int> > g(n,em);
    for(int i=0;i<m;i++){
        int t1,t2;
        cin>>t1>>t2;
        g[t1-1].push_back(t2-1);
        g[t2-1].push_back(t1-1);
    }
    cout<<dfs(g,n)-1<<"\n";
    return 0;
}

Measured memory_bytes: 10080
#include <stdio.h>

int main()
{
	int N;
	scanf("%d", &N);
	int p[N + 1];
	int i = 1;
	int ans = 0;
	int min;

	while (i <= N)
		scanf("%d", &p[i++]);
	i = 1;
	min = p[1];
	while (i <= N)
	{
		if (min >= p[i])
		{
			min = p[i];
			ans++;
		}
		i++;
	}
	printf("%d\n",ans);
	return (0);
}


Measured memory_bytes: 896
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

typedef complex<double> P;

struct Pid {
    P p;
    int id;

    Pid() {}
    Pid(P a, int b): p(a), id(b) {}

    bool operator < (const Pid& o) const {
        return real(p) == real(o.p) ? imag(p) < imag(o.p) : real(p) < real(o.p);
    }
};

double cross(const P a, const P b) {
    return real(a) * imag(b) - imag(a) * real(b);
}

double dot(const P a, const P b) {
    return real(a) * real(b) + imag(a) * imag(b);
}

bool has_intersection(const P k1, const P k2, const P l1, const P l2) {
    return cross(l1-k1, k2-k1) * cross(l2-k1, k2-k1) < 0 &&
        cross(k1-l1, l2-l1) * cross(k2-l1, l2-l1) < 0;
}

P intersect(const P k1, const P k2, const P l1, const P l2) {
    assert(has_intersection(k1, k2, l1, l2));
    //  { ((l2-l1) . (k1-l1)) / abs(l2-l1)^2 } * (l2-l1) + l1
    double c1 = abs(cross(k2-k1, l1-k1)), c2 = abs(cross(k2-k1, l2-k1));
    return l1 + c1 / (c1 + c2) * (l2-l1);
}

int xa, ya, xb, yb, N;
P s[100], t[100];
int o[100], l[100];

int solve() {
    P a(xa, ya), b(xb, yb);

    vector<Pid> its;
    for (int j = 0; j < N; ++j) if (has_intersection(a, b, s[j], t[j])) {
        its.emplace_back(intersect(a, b, s[j], t[j]), j);
    }

    sort(begin(its), end(its));

    int ans = 0;
    for (int j = 0; j < (int)its.size() - 1; ++j) {
        int v = o[its[j].id] == 1 ? l[its[j].id] : 1 - l[its[j].id];
        int w = o[its[j+1].id] == 1 ? l[its[j+1].id] : 1 - l[its[j+1].id];
        if (v != w) {
            ++ ans;
        }
    }
    return ans;
}

int main() {
    int datasets; cin >> datasets;
    for (int d = 0; d < datasets; ++d) {
        cin >> xa >> ya >> xb >> yb >> N;
        for (int j = 0; j < N; ++j) {
            int sx, sy, tx, ty;
            cin >> sx >> sy >> tx >> ty >> o[j] >> l[j];
            s[j] = P(sx, sy); t[j] = P(tx, ty);
        }
        cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

ll GCD(ll a, ll b) {
    return (b > 0) ? GCD(b, a % b) : a;
}

ll LCM(ll a, ll b) {
    return a / GCD(a, b) * b;
}

int main() {
    int n;
    cin >> n;
    ll ans = 1;
    rep(i, n){
        ll t;
        cin >> t;
        ans = LCM(ans, t);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CRectangleCutting {
public:
    void solve(std::istream &in, std::ostream &out) {
        int w, h, x, y;
        in >> w >> h >> x >> y;
        double res = (ll) w * h / 2.0;
        bool mul = 2 * x == w and 2 * y == h;
        out << fixed << setprecision(6) << res << ' ' << mul << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CRectangleCutting solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	ans := 0
	highest := 0
	for i := 0; i < n; i++ {
		h := nextInt()
		if h >= highest {
			ans++
			highest = h
		}
	}
	fmt.Println(ans)
}


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

namespace C_gacha
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] Thg = new string[N];



            for (int i = 0; i < N; i++)
            {
                Thg[i] = Console.ReadLine();
            }

            Console.WriteLine(Thg.Distinct().ToArray().Length);
            Console.Read();
        }
    }
}


Measured memory_bytes: 49716
#include<iostream>
#include<vector>
#include<string>
#include<set>

using namespace std;



int main() {
	set<string> candidate;
	string s;
	int k;
	cin >> s >> k;
	char c;
	for (int i = 0; i < 26; i++) {
		c = i + 97;
		auto pos = s.find(c);
		if (pos == string::npos) continue;

		while (pos != string::npos) {
			for (int j = 1; j < 6; j++) {
				candidate.insert(s.substr(pos, j));
			}
			pos = s.find(c, pos + 1);
		}
		if (candidate.size() >= k) break;
 	}
	auto itr = candidate.begin();
	for (int i = 1; i < k; ++i) ++itr;
	cout << *itr << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
string S,T,tmp,res;
bool f;
int main()
{
    cin>>S>>T;
    res = "";
    if(T.size() > S.size())
    {
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }

    for (int i = 0; i <= S.size() - T.size(); i++)
    {
        f = true;
        tmp = S;
        for (int j = 0; j < T.size(); j++)
        {
            if(tmp[i + j] != '?' && tmp[i + j] != T[j])
            {
                f = false;
                break;
            }
            tmp[i + j] = T[j];
        }
        if(f == true)
            res = tmp;
    }
    if(res != "")
    {
        for (int i = 0; i < S.size(); i++)
            if(res[i] == '?')
                res[i] = 'a';
        cout<<res<<endl;
    }
    else
        cout<<"UNRESTORABLE"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    cout << ((m1 < m2)? 1 : 0) << endl;


	return 0;
}



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

int main() {
	int num[5];
	scanf("%d %d %d %d %d",&num[0],&num[1],&num[2],&num[3],&num[4]);
	sort(num,num+5);
	printf("%d %d %d %d %d\n",num[4],num[3],num[2],num[1],num[0]);
}

Measured memory_bytes: 1204
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().ToCharArray();

            for(int i=0;i<3;i++)
            {
                if(n[i] == '1') n[i] = '9';
                else if(n[i] == '9') n[i] = '1';
                Console.Write(n[i]);
            }

            Console.WriteLine();

            


        }
    }
}


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

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	int su = 0;
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		su += x;
	}
	int ans = max (-1, n - su);
	cout << ans << "\n";
}
	


Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatoro {
    static void Main() {
        int cnt = 0;
        int N = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        for(int i = 0; i < N; i++) {
           
           if( i+1 == a[a[i]-1]) {
                cnt++;
            }
        }
        Console.WriteLine(cnt / 2);
      

    }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    ll h, w;
    cin >> h >> w;
    if (h == 1 || w == 1) cout << 1;
    else if (h % 2 != 0 && w % 2 != 0) cout << (h * w) / 2 + 1;
    else cout << (h * w) / 2;
    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 n = sc.nextInt();
int[] rev;
rev = new int[n];


for(int i=0;i<n;i++){
rev[i]=sc.nextInt();
}
for(int i=0;i<n;i++){

if(i!=n-1){
System.out.printf("%d ",rev[n-1-i]);
}else{
    System.out.printf("%d\n",rev[n-1-i]);   
}
}

sc.close();
}

}


Measured memory_bytes: 26512
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	int a;
	cin >> a;

	cout << a + pow(a,2) + pow(a,3) << endl;

	return 0;
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    ll n, ans = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>

int gcd(int,int);

main(){

  int x,y,d;

  scanf("%d%d",&x,&y);

  d = gcd(x,y);

  printf("%d\n",d);

  return 0;

}


int gcd(int x, int y){

  int tmp;

  if(x < y){
    tmp = x;
    x = y;
    y = tmp;
  }

  while(y!=0){
    tmp = y;
    y = x % y;
    x = tmp;
  }

  return x;

}

Measured memory_bytes: 592
/**
class cfmaster {
 public:
  struct code {
  	see the details down there !
  };
};
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
  	int x;
  	cin >> x;
  	sum += x;
	}
	cout << (sum >= k ? "Yes" : "No") << '\n';
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll             long long int
#define lb             lower_bound
#define fi             first
#define ub             upper_bound
#define se              second
#define mp             make_pair
#define vll            vector<ll>
#define mod            1000003
#define endl            "\n"
#define fast           ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb             push_back
#define sz               size()
#define all(v)         v.begin(),v.end()
#define allr(v)        v.rbegin(),v.rend()
#define inp(V,n)       for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)       {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<double,double> &a,
               const pair<double,double> &b)
{
    if(a.fi==b.fi)
    {
    return (a.second >b.second);
    }
    else
        return (a.fi<b.fi);
}
int main()
{ int t=1;
   //cin>>t;
   while(t--)
  { ll n,i,j,k;
  cin>>n;
  ll a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
    ll ans=0;
  sort(a,a+n);
  for(i=0;i<n;i++)
  {
      for(j=i+1;j<n;j++)
      {
          for(k=j+1;k<n;k++)
          {
              if(a[i]==a[j] || a[i]==a[k]|| a[k]==a[j])
                continue;
              if(a[i]+a[j]>a[k])
                ans++;
          }
      }
  }
  cout<<ans<<endl;

  }
return 0;
}


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

using ll = int_fast64_t;
#define rep(i,n) for(int i=0;i<(n);++i)

signed main(){

  int N,K,R,S,P;
  string T;
  cin>>N>>K>>R>>S>>P>>T;

  auto solve = [&](string const& s){
    int n = size(s);
    vector dp(n+1,vector(3,0));
    rep(i,n){
      if(s[i]=='r')dp[i+1][0] = max(dp[i][1],dp[i][2])+P;
      if(s[i]=='s')dp[i+1][1] = max(dp[i][0],dp[i][2])+R;
      if(s[i]=='p')dp[i+1][2] = max(dp[i][0],dp[i][1])+S;
      rep(j,3)rep(k,3)if(j!=k)dp[i+1][j] = max(dp[i+1][j],dp[i][k]);
    }
    return max({dp[n][0],dp[n][1],dp[n][2]});
  };

  vector<string> s(K);
  rep(i,N)s[i%K]+=T[i];

  ll ans = 0;
  rep(i,K)ans += solve(s[i]);
  cout<<(ans)<<endl;

}

Measured memory_bytes: 8744
from bisect import bisect_right
from bisect import bisect_left
 
n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
cnt = 0
bn = []
for i in range(n):
    x1 = bisect_left(a, b[i])
    x2 = bisect_right(c, b[i])
    cnt += x1*(n-x2)
print(cnt)

Measured memory_bytes: 23360
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define pb push_back
#define log(x,b) (log(b)/log(x))
#define rep(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int mod=1e9+7;
int32_t main()
{
    int n,t;
    cin>>n>>t;
    vi v(n);
    rep(i,0,n)cin>>v[i];
    int res=0;
    for(int i=1;i<n;i++){
        if(v[i]-v[i-1]>t)res+=t;
        else res+=v[i]-v[i-1];
    }
    res+=t;
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 4656
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
int i[1111111];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d=0,e,f;
  cin >>a>>b>>c;
  d=c/a*b;
  cout <<d<<'\n';
  return (0);
}


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

int main(){
  int N;
  cin >>N;
  if(N%27 == 13 || N%27 == 26) cout << ":(" << endl;
  else if (N%27 == 0)cout << N*100/108 << endl;
  else cout << N*100/108+1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1e5+9;
struct node{
	int d,id;
	node(int d=0,int id=0):d(d),id(id){}
	friend bool operator<(node x,node y){
		return x.d<y.d;
	}
}d[maxn];
int n,dis,tot,siz[maxn],u[maxn],v[maxn];
signed main(){
	cin>>n;
	for(int i=1,x;i<=n;++i)cin>>x,d[i]=node(x,i),siz[i]=1;
	sort(d+1,d+1+n);
	for(int i=n;i>1;--i){//最大的一定是叶子 可以递推siz
		int nxt=d[i].d-n+2*siz[i];//下一个的d
		int p=lower_bound(d+1,d+1+n,node(nxt,0))-d;
		if(d[p].d!=nxt)return puts("-1"),0;//如果找不到 不符合
		u[++tot]=d[i].id;v[tot]=d[p].id;
		siz[p]+=siz[i];
		dis+=siz[i];
	}
	if(dis!=d[1].d)puts("-1");//因为只判断了d之差的关系 要看找出的siz是否符合条件
	else{
		for(int i=1;i<=tot;++i)cout<<u[i]<<" "<<v[i]<<endl;
	}
	return 0;
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

const i64 INF = inf<i64>;
using P = pair<i64, i64>;
signed main() {
  i64 X;
  cin >> X;
  vector<i64> dp(101000, 0);
  dp[0] = 1;
  for (i64 p = 0; p <= X; p++) {
    dp[p + 100] |= dp[p];
    dp[p + 101] |= dp[p];
    dp[p + 102] |= dp[p];
    dp[p + 103] |= dp[p];
    dp[p + 104] |= dp[p];
    dp[p + 105] |= dp[p];
  }
  cout << (dp[X] ? 1 : 0) << endl;
}


Measured memory_bytes: 1024
/* Made By :- Vishal Bharambe*/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<long long int> 
#define vvi vector<vi>
#define pii pair<int,int>;
#define pll pair<ll,ll>;
#define vll vector<pll>;
#define vii vector<pii>;
#define vs vector<string>;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define rforn(i, n) for (int i = n-1; i >= 0; i--)
#define all(v) v.begin(),v.end()
ll power(ll x,ll n) {ll result=1; while(n) {if(n%2==1) result=result*x; n=n/2; x=x*x;} return result;}
ll gcd(ll a, ll b)  {if(!b)return a;return gcd(b, a % b);} 
ll lcm(ll a , ll b) {return (a*b)/gcd(a,b);}
int dir[4][2] = { {-1, 0}, {0, 1}, {1, 0}, {0, -1} };
int main()
{
    int n;
    cin>>n;
    int  arr[n];
    forn(i,n){
    	cin>>arr[i];
    }
    long long int dp[n];
    memset(dp,10001,sizeof(dp));
    dp[1]=abs(arr[1]-arr[0]);
    dp[0]=0;
    if(n>2){	
    	for(int i=2;i<n;i++){
    		dp[i]= min(dp[i],dp[i-1]+abs(arr[i]-arr[i-1]));
    		dp[i]=min(dp[i],dp[i-2]+abs(arr[i]-arr[i-2]));
    	}
    	cout<<dp[n-1];
    }
    else if(n==2){
    	cout<<dp[1];
    }
    else{
    	cout<<0;
    }
}

Measured memory_bytes: 4688
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Failed to read line.");
    let x: Vec<&str> = input.trim().split_whitespace().collect();
    if x.len() == 1 {
        let mut count = 0;
        let n:u32 = x[0].trim().parse().unwrap();
        for i in 1..(n+1) {
            count += i;
        }
        println!("{}", count);
    }
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
#define int long long
using namespace std;

const int TREE_SZ = 1 << 19;

vector<int> mx(TREE_SZ, -2e18);
vector<int> buf(TREE_SZ);

void upd(int v, int l, int r) {
    mx[v] += buf[v];
    if (l < r - 1) {
        buf[2 * v + 1] += buf[v];
        buf[2 * v + 2] += buf[v];
    }
    buf[v] = 0;
}

void add_seg(int v, int l, int r, int L, int R, int x) {
    upd(v, l, r);
    if (r <= L || R <= l) {
        return;
    }
    if (L <= l && r <= R) {
        buf[v] += x;
        upd(v, l, r);
        return;
    }
    int m = (l + r) / 2;
    add_seg(2 * v + 1, l, m, L, R, x);
    add_seg(2 * v + 2, m, r, L, R, x);
    mx[v] = max(mx[2 * v + 1], mx[2 * v + 2]);
}

void set_elem(int v, int l, int r, int i, int x) {
    upd(v, l, r);
    if (l == r - 1) {
        mx[v] = x;
        return;
    }
    int m = (l + r) / 2;
    if (i < m) {
        set_elem(2 * v + 1, l, m, i, x);
        upd(2 * v + 2, m, r);
    } else {
        upd(2 * v + 1, l, m);
        set_elem(2 * v + 2, m, r, i, x);
    }
    mx[v] = max(mx[2 * v + 1], mx[2 * v + 2]);
}

int32_t main() {
    int n, m;
    cin >> n >> m;
    vector<int> l(n, 0);
    vector<vector<pair<int, int>>> r(n + 1);
    for (int i = 0; i < m; i++) {
        int L, R, a;
        cin >> L >> R >> a;
        L--;
        l[L] += a;
        r[R].push_back({L, a});
    }
    int cur_max = 0;
    set_elem(0, -1, n, -1, 0);
    for (int i = 0; i < n; i++) {
        add_seg(0, -1, n, -1, i, l[i]);
        for (auto x: r[i]) {
            add_seg(0, -1, n, -1, x.first, -x.second);
        }
        cur_max = max(cur_max, mx[0]);
        set_elem(0, -1, n, i, mx[0]);
    }
    cout << cur_max << endl;
}


Measured memory_bytes: 23700
A, B, C, X = [int(input()) for _ in range(4)]

count = 0

for i in range(A + 1):
    for j in range(B + 1):
        remain = X - 500 * i - 100 * j
        if 0 <= remain:
            if remain <= 50 * C:
                count += 1
            else:
                continue
        else:
            break

print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;

int main() {
    int N;
    cin >> N;
    vi H(N);
    for (auto i = 0; i < N; i++) {
        int hi;
        cin >> hi;
        H.at(i) = hi;
    }

    vi dp(N);
    dp.at(0) = 0;
    dp.at(1) = abs(H.at(0) - H.at(1));
    for (auto i = 2; i < N; i++) {
        dp.at(i) = min(dp.at(i - 1) + abs(H.at(i) - H.at(i - 1)), dp.at(i - 2) + abs(H.at(i) - H.at(i - 2)));
    }

    cout << dp.at(N - 1) << endl;
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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*(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;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
int main(void){
    int n;cin>>n;
    map<int,int> mp;
    int l=-1,r=-1;
    rep(i,n+1){
        int a;cin>>a;
        if(mp[a]!=0){
            l=mp[a]-1;r=n-i;
            break;
        }
        mp[a]=i+1;
    }
    int y=l+r;
    combination c(100100);
    cout<<n<<endl;
    rep1(i,n+1){
        if(i==1)continue;
        //cout<<buf.x<<endl;
        mint res=c(n+1,i)-c(y,i-1);
        cout<<res.x<<endl;
        //return 0;
    }
}

Measured memory_bytes: 9468
#include <bits/stdc++.h>
#define N ('z'-'a')
using namespace std;
int n,ans,mp[N+1];
string str[501];

void mk_mp(int pos,int i,int j){
  while(i<=j&&!str[i][pos])i++;
  if(i>=j)return;
  int ni=i,ch=str[i][pos]-'a';

  while(i<j&&ch==str[++i][pos]-'a')if(str[i-1][pos+1]&&!str[i][pos+1])ans=0;
  mk_mp(pos+1,ni,i-1);

  int a=str[i][pos]-'a';
  if(ch!=a){
    mk_mp(pos,i,j);
    mp[ch]|=(1<<a|mp[a]);
    ans*=!(mp[ch]&1<<ch);
  }

}

int main(){
  while(cin>>n,n){
    memset(mp,0,sizeof(mp));
    for(int i=0;i<n;i++)cin>>str[i];
    ans=1;
    mk_mp(0,0,n-1);
    cout <<(ans? "yes":"no")<<endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include<cstdio>
#include<algorithm>
using namespace std;
using ull = unsigned long long;
const static int MAX_N = 1e3 + 5;
const static int MAX_V = 1e4 + 5;


ull dp[MAX_N][MAX_V];

int main(){
	int H, N;
	scanf("%d %d", &H, &N);
	ull A[N], B[N];
	for (int i = 0; i < N; ++i) scanf("%llu %llu", A + i, B + i);
	for (int i = 1; i <= H; ++i){
		dp[0][i] = ((i - 1)/A[0] + 1)*B[0];
	}
	for (int i = 1; i < N; ++i){
		for (int j = 0; j < A[i] && j <= H; ++j){
			dp[i][j] = min(dp[i-1][j], B[i]);
		}
		for (int j = A[i]; j <= H; ++j){
			dp[i][j] = min(dp[i-1][j], dp[i][j - A[i]] + B[i]);
		}
	}
	printf("%llu\n", dp[N-1][H]);
	return 0;
}

Measured memory_bytes: 78336
# ARC072C - Sequence (ABC059C)
def seq_modifier(lst: list, flg: bool) -> int:  # true: positive
    """
    ARC072C - Sequence
    https://atcoder.jp/contests/abc072/tasks/arc072_a
    """
    cur, cnt = 0, 0
    for i in lst:
        cur += i
        if flg and cur <= 0:
            cnt += abs(cur) + 1
            cur = 1
        elif not flg and cur >= 0:
            cnt += abs(cur) + 1
            cur = -1
        flg = not flg
    return cnt


def main():
    n = int(input())
    lst = list(map(int, input().rstrip().split()))
    print(min(seq_modifier(lst, True), seq_modifier(lst, False)))


if __name__ == "__main__":
    main()

Measured memory_bytes: 14332
s = input()
s = s[0:-1]
if len(s) % 2 != 0:
    s = s[:-1]

for i in reversed(range(0, len(s)+2, 2)):
    half = i//2
    if s[:half] == s[half:]:
        print(len(s))
        break
    s = s[:-2]


Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <iomanip>
using namespace std;

typedef long long ll;
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using P = pair<ll, ll>;
const int INF = 1001001001;
const ll modN = 1000000007;

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

struct uf {
    vector<ll> par;
    vector<ll> sizes;

    uf(int n)
    {
        for(int i = 0; i < n; i++) {
            par.push_back(i);
            sizes.push_back(1);
        }
    }

    ll root(int x) 
    {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) 
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
        sizes[ry] = sizes[rx] + sizes[ry];
    }

    bool same(int x, int y) 
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    ll size(int x)
    {
        return sizes[root(x)];
    }
};

class Radix {
private:
  const char* s;
  int a[128];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};

struct node
{
    public: ll x;
    public: ll y;

    node(ll xx, ll yy)
    {
        x = xx;
        y = yy;
    }
};

ll comb(int n, int r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v[n][r];
}

ll digit(ll num)
{
    if(num < 10)
    {
        return 1;
    }

    ll d = 1;
    ll k = 10;
    while(num >= k)
    {
        d++;
        k *= 10;
    }

    return d;
}

ll digitNum(ll num, ll count)
{
    ll a = (num % (ll) pow((double) 10, (double) count));
    return a / pow(10, count - 1);
}

bool less_abs(int lhs, int rhs) {
    if(lhs < 0)
    {
        lhs *= -1;
    }
    if(rhs < 0)
    {
        rhs *= -1;
    }

    return lhs < rhs;
}

bool IsTrueBit(int bit, int index)
{
    return (bit & (1 << index));
}

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

    Radix r;

    cout << r.to(n, k).size() << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    string S[N];
    rep(i,N) cin >> S[i];
    vc<pi> r,l;
    rep(i,N) {
        int sum=0,min=0;
        rep(j,SZ(S[i])) {
            if(S[i][j]=='(') sum++;
            else sum--;
            chmin(min,sum);
        }
        if(sum>=0) r.emplace_back(-min,sum);
        else l.emplace_back(-(min-sum),-sum);
    }
    sort(all(r));
    sort(all(l));
    int sumr=0,suml=0;
    bool can=true;
    rep(i,SZ(r)) {
        if(sumr-r[i].fi<0) can=false;
        sumr+=r[i].se;
    }
    rep(i,SZ(l)) {
        if(suml-l[i].fi<0) can=false;
        suml+=l[i].se;
    }
    if(can && sumr==suml) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 50240
///in the name of Allah the most beneficent the most merciful.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
#define out(x) cout << #x << " -> " << x << endl;
using namespace std;
const ll N = 200010, M = 2000005;
ll n, k, a[N],res;
int solve()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        in1(a[i]);
    sort(a, a+n);
    for(int i=0;i<k;i++)
        res+=a[i];
    printf("%lld\n", res);
    return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int ret = solve();
    return 0;
}
/*

*/


Measured memory_bytes: 3832
# ABC152b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)

    a = list(input().split())
    b = [a[0] * int(a[1]), a[1] * int(a[0])]
    b.sort()
    print(b[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;


bool solve(){
	int n, m;
	cin>> n;
	vector<string> ID(n);
	for(int i=0;i<n;i++){
		string str;
		cin>> str;
		ID[i] = str;
	}
	cin>> m;	//ココ...
	int cnt = 0;
	for(int i=0;i<m;i++){
		string in;
		cin>> in;
		int status = 0;
		for(int j=0;j<n;j++){
			if(in == ID[j]){
				status++;
				break;
			}
		}
		if(!status){
			cout<< "Unknown ";
		}else{
			if(cnt%2){
				cout<< "Closed by ";
			}else{
				cout<< "Opened by ";
			}
			cnt++;
		}
		cout<< in<< endl;
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

 

Measured memory_bytes: 1220
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000009
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REPR(i, n) for(int i = n - 1; 0 <= i; i--)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define FORR(i, s, e) for(int i = s; e <= i; i--)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

vector<vector<vector<int>>> b(4);

int main() {
    int H, W;
    cin >> H >> W;
    W += 2;
    H += 2;
    vector<string> m(H);
    char aa[4002];
    REP(i, 4002) { aa[i] = '#'; }
    aa[4001] = '\0';
    m[0] = string(aa);
    m[H - 1] = string(aa);

    REP(i, H - 2) {
        string tmp;
        cin >> tmp;
        m[i + 1] = string("#") + tmp + string("#");
    }

    REP(i, 4) {
        b[i].resize(W + 2);
        REP(j, W) { b[i][j].resize(H + 2); }
    }

    REP(x, W) {
        REP(y, H) {
            if(m[y][x] == '#' || x == 0 || x == W - 1 || y == 0 || y == H - 1) {
                int tx, ty, cnt;
                tx = x + 1, ty = y, cnt = 0;
                while(tx < W && m[ty][tx] == '.') {
                    chmax(b[0][tx][ty], cnt);
                    cnt++;
                    tx++;
                }
                tx = x - 1, ty = y, cnt = 0;
                while(0 <= tx && m[ty][tx] == '.') {
                    chmax(b[1][tx][ty], cnt);
                    cnt++;
                    tx--;
                }
                tx = x, ty = y + 1, cnt = 0;
                while(ty < H && m[ty][tx] == '.') {
                    chmax(b[2][tx][ty], cnt);
                    cnt++;
                    ty++;
                }
                tx = x, ty = y - 1, cnt = 0;
                while(0 <= ty && m[ty][tx] == '.') {
                    chmax(b[3][tx][ty], cnt);
                    cnt++;
                    ty--;
                }
            }
        }
    }

    int ma = 0;
    REP(x, W) {
        REP(y, H) {
            if(m[y][x] == '.') {
                int sum = 0;
                REP(i, 4) { sum += b[i][x][y]; }
                chmax(ma, sum + 1);
            }
        }
    }
    cout << ma;
    return 0;
}

Measured memory_bytes: 71168
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    string s; cin>>s;
    bool ans=false;
    //[i,j)
    //[0,sz)
    rep(i,sz(s))FOR(j,i,sz(s)+1){
        string t="";
        rep(k,i) t+=s[k];
        FOR(l,j,sz(s)) t+=s[l];
        
        if(t=="keyence") ans=true;
    }
    
    if(ans) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}



Measured memory_bytes: 3636
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    d = int(input())
    d = math.radians(d)
    x = 0
    y = 1
    cnt = 1
    while True:
        if abs(x)<=0.001 and abs(y) <=0.001:
            print(cnt)
            exit()
        x -= math.sin(d*cnt)
        y += math.cos(d*cnt)
        cnt += 1

if __name__=="__main__":
    main()


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

int main(){
    int n;cin>>n;bool ans=0;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(n==i*j) ans=1;
        }
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<"\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=100;
	cin>>n;
	for(;n--;)
	{
		int x,s=0;
		cin>>x;
		while(x%2==0) s++,x/=2;
		if(ans>s) ans=s;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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



int main() {
  string S,T;
  cin>>S;
  cin>>T;

  string ans = "UNRESTORABLE";

  for(int i=S.size()-T.size();i>=0;i--){
    int flag=0;
    FOR(j,0,T.size()-1){
      if(S[i+j]!='?' && S[i+j]!=T[j]){
        flag=1;
      }
    }

      if(flag==0){
        FOR(j,0,T.size()-1){
          S[i+j]=T[j];
        }
        FOR(j,0,S.size()-1){
          if(S[j]=='?'){
            S[j]='a';
          }
        
        }
          cout<<S<<endl;
          return 0;
      }
    


  }

  cout<<ans<<endl;
  return 0;


 
}
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k;
    char s[111];
    cin>>k>>s + 1;
    int len = strlen(s + 1);
    if(len <= k){
        puts(s + 1);
    }
    else{
        for(int i = 1;i <= k; i++)putchar(s[i]);
        puts("...");
    }
    return 0;
}


Measured memory_bytes: 3632