akhauriyash/Code-Regression huggingface dataset:
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define FOR(x,n)                for (ll i=x,j=x,k=x;i<n,j<n,k<n;i++,j++,k++)
#define FORR(n,x)               for (ll i=n-1,j=n-1,k=n-1;i>=x,j>=x,k>=x;i--,j--,k--)
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;
ll tc=1;


void solve()
{
    ll n,tot;
    cin>>n>>tot;

    for (int i=0;i<=n;i++)
    {
        if ((i*4+(n-i)*2)==tot)
        {
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;

}

int32_t main()
{
    FAST_IO();
    //TEST_CASES()
        solve();
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, k, n) for (int i = (int)(k); i < (int)(n); ++i)
#define rrep(i, k, n) for (int i = (int)(n) - 1; i >= (int)(k); --i)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vv_ii;
typedef pair<int,ii> i_ii;
typedef vector<i_ii> vi_ii;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

template <class T>
inline ostream& operator<<(ostream & o, vector<T> const& v) {
    for (int i = 0; i < (int)(v.size()) - 1; ++i)
        o << v[i] << ' ';
    if (!v.empty())
        o << v.back();
    return o;
}

template <class T, class Q>
inline ostream& operator<<(ostream & o, pair<T,Q> const& p) {
    o << "(" << p.fi << "," << p.se << ")";
    return o;
}


int main(){

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

    char c;
    cin >> c;
    cout << (char)(c + 1) << '\n';
    


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)



int main() {
	int N, M;
	cin >> N >> M;
	vector<bool> g(N);
	vector<int> H(N);
	rep(i, N) {
		cin >> H[i];
		g[i] = true;
	}
	rep(ccc, M) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		if (H[a] <= H[b]) g[a] = false;
		if (H[b] <= H[a]) g[b] = false;
	}
	int cnt = 0;
	rep(i, N) if (g[i]) cnt++;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3700
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

    int n; cin >> n;

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

    bool flag = true;
    for(int i=1; i<n; i++){

        // cout << h[i-1] << " " << h[i] << endl;
        if(h[i] > h[i-1]){
            h[i]--;
        }
        // cout << h[i-1] << " " << h[i] << endl;
        if(h[i] < h[i-1]){
            flag = false;
            break;
        }
    }

    cout << (flag ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
int main()
{
	int n = 0, b = 0, rate[100] = {};
	std::cin >> n;
	bool gray = false;
	bool brown = false;
	bool green = false;
	bool rightblue = false;
	bool blue = false;
	bool yellow = false;
	bool orange = false;
	bool red = false;
	bool yomaru = false;
	bool black = false;
	int count = 0;
	int yomarucount = 0;
	for (int i = 0; i < n; i++)
	{
		std::cin >> rate[i];
		if (1 <= rate[i] && rate[i] <= 399) {
			if (gray == 0) {
				count++;
				gray = true;
			}

		}
		else if (400 <= rate[i] && rate[i] <= 799) {
			if (brown == 0) {
				count++;
				brown = true;
			}

		}
		else if (800 <= rate[i] && rate[i] <= 1199) {
			if (green == 0) {
				count++;
				green = true;
			}

		}
		else if (1200 <= rate[i] && rate[i] <= 1599) {
			if (rightblue == 0) {
				count++;
				rightblue = true;
			}

		}
		else if (1600 <= rate[i] && rate[i] <= 1999) {
			if (blue == 0) {
				count++;
				blue = true;
			}

		}
		else if (2000 <= rate[i] && rate[i] <= 2399) {
			if (yellow == 0) {
				count++;
				yellow = true;
			}

		}
		else if (2400 <= rate[i] && rate[i] <= 2799) {
			if (orange == 0) {
				count++;
				orange = true;
			}

		}
		else if (2800 <= rate[i] && rate[i] <= 3199) {
			if (red == 0) {
				count++;
				red = true;
			}


		}
		else {
			yomarucount++;
			yomaru = true;
		}

	}

	if (count == 0) {
		std::cout << 1 << " " << yomarucount;
		yomaru = false;
	}

	else if (yomaru) {
		b = count + yomarucount;

		std::cout << count << " " << b << std::endl;
	}
	else {
		std::cout << count << " " << count << std::endl;
	}
}

	
	
	


Measured memory_bytes: 256
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int n;
  cin >> n;
  ll d;
  cin >> d;
  int cnt = 0;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    if(x*x+y*y <= d*d)
    cnt++;
  }
  cout << cnt << "\n";
}

int main()
{
  init_main();
  solve();
}


Measured memory_bytes: 3648
#include <stdio.h>
// int main(void){
//     // Your code here!
//     char str[100];
//     scanf("%s", str);
//     for(int i = 0; i < 3; i++){
//         if(str[i] == str[i+1]){
//             printf("Bad");
//             return 0;
//         }
//     }
//     printf("Good");
//     return 0;
// }

int main(){
    int N, L, ans=0;
    scanf("%d %d", &N, &L);
    
    // if((N%2 == 1) && ((N-1)/2+L == 0)){
    //     printf("0\n");
    //     return 0;
    // }
    // L = (N/2+L>0) ? L : L+1;
    // N = (N/2+L>0) ? N : N--;
    // printf("%d %d\n", N/2+L, L);
    for(int i=0; i < N; i++){
        ans += L+i;
    }
    //printf("%d %d\n", ans, L+N-1);
    ans -= L>=0 ? L : N>=(L*-1)+1 ? 0 : L+N-1;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
function main(input) {
  var input_num = Number(input);

  var two_count = 0;
  while(input_num > 0) {
    if (input_num %10 == 2) { 
      two_count++;
    }
    input_num = Math.floor(input_num / 10);
  }
  console.log(two_count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

using ll = long long;

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

    vector<int> v(n);

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

    sort(v.begin(), v.end());

    ll ans = 0;
    for (int i = 0; i < k; i++) {
        ans += v[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS cin.tie(0);ios::sync_with_stdio(false)
#define MP_ make_pair
#define PB_ push_back
#define FIR first
#define SEC second
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;
int ctoi(char c){if(c>='0' and c<='9'){return (int)(c-'0');}return -1;}

const int M = 100000;


int main()
{
  //IOS; /* making cin faster */
  int N;

  scanf("%d",&N);

  vector<int> v(N);
  vector<int> freq0(M,0);
  vector<int> freq1(M,0);
  

  REP(i,N)
    {
      scanf("%d",&v[i]);

      if( i % 2 == 0 )
	{
	  ++ freq0[v[i]-1];
	  
	}
      else
	{
	  ++ freq1[v[i]-1];
	  
	}
      
    }

  int v0_1st = 1;
  int v1_1st = 1;

  

  REP(i,M)
    {
      if( freq0[i] > freq0[v0_1st-1]  )
	{
	  v0_1st = i + 1;
	  
	}

      if( freq1[i] > freq1[v1_1st-1]  )
	{
	  v1_1st = i + 1;
	  
	}
      
    }

  
  int v0_2nd;
  int v1_2nd;

  if( v0_1st != 1 )
    {
      v0_2nd = 1;
      
    }
  else
    {
      v0_2nd = 2;
      
    }

  if( v1_1st != 1 )
    {
      v1_2nd = 1;
      
    }
  else
    {
      v1_2nd = 2;
      
    }

  
  REP(i,M)
    {
      if( freq0[i] > freq0[v0_2nd-1] and i != v0_1st-1  )
	{
	  v0_2nd = i + 1;
	  
	}

      if( freq1[i] > freq1[v1_2nd-1] and i != v1_1st-1  )
	{
	  v1_2nd = i + 1;
	  
	}
      
    }

  int cnt1 = 0;
  int cnt2 = 0;


  if( v0_1st != v1_1st )
    {
      REP(i,N)
	{
	  if( i % 2 == 0 and v[i] != v0_1st )
	    {
	      ++ cnt1;
	      
	    }

	  if( i % 2 == 1 and v[i] != v1_1st )
	    {
	      ++ cnt1;
	      
	    }

	  
	}

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

      
      
    }
  else
    {

      REP(i,N)
	{
	  
	  if( i % 2 == 0 and v[i] != v0_1st )
	    {
	      ++ cnt1;
	      
	    }

	  if( i % 2 == 1 and v[i] != v1_2nd )
	    {
	      ++ cnt1;
	      
	    }

	  
	  if( i % 2 == 0 and v[i] != v0_2nd )
	    {
	      ++ cnt2;
	      
	    }

	  if( i % 2 == 1 and v[i] != v1_1st )
	    {
	      ++ cnt2;
	      
	    }

	  
	}


      printf("%d\n",min(cnt1,cnt2));
      
      
    }

  

}


Measured memory_bytes: 1408
var s,t,m,s1,s2:ansistring;
var n,i,j,k,l,ans:longint;
var a,b:array[0..100] of ansistring;
{var r:boolean;
function min(a,b:ansistring):ansistring;
var i:longint;
var t:ansistring;
begin
  if length(a)>length(b) then begin t:=a;a:=b;b:=t;end;
  for i:=1 to length(a) do
    if ord(a[i])<ord(b[i]) then exit(a)
    else if ord(b[i])<ord(a[i]) then exit(b);
  exit(a);
end;}
function same(a,b:ansistring):boolean;
var i:longint;
begin
  for i:=1 to length(a) do if (a[i]<>b[i]) and (a[i]<>'?') then exit(false);
  exit(true);
end;
begin
  readln(s);readln(t);s1:='';
  for i:=length(s)-length(t)+2 to length(s) do s1:=s1+s[i];
  s1:=s1+'1';
  for i:=length(s)-length(t)+1 downto 1 do
  begin
    s1:=s[i]+s1;delete(s1,length(s1),1);
    //writeln(s1);
    if same(s1,t) then
    begin
      //writeln(i,' ',s1);
      m:=s;k:=0;
      for j:=i to i+length(s1)-1 do begin inc(k);m[j]:=t[k];end;
      for j:=1 to length(m) do if m[j]='?' then m[j]:='a';
      writeln(m);exit;
    end;
  end;
  writeln('UNRESTORABLE');
end.

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){

    long a, b , ans = 0;
	string sans = "Zero";
	cin >> a >> b;

	ans = (a > 0) ? 1 : ans;
	ans = (b < 0) ? ((b - a + 1) % 2 == 0) ? 1 : -1 : ans;

	sans = (ans == 1) ? "Positive" : sans;
	sans = (ans == -1) ? "Negative" : sans;
	cout << sans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		 Scanner sc = new Scanner(System.in);
	     int S = sc.nextInt();
	     int h = S/3600 ;
	     int m = (S-h*3600)/60;
	     int s = S-h*3600-m*60;
	     
	     System.out.println(h+ "" +":"+ "" +m+ "" +":"+ "" +s);

	    
	     
	}

}


Measured memory_bytes: 26328
#include <iostream>
using namespace std;
  
int F[102][102];
  
void DFS(int Y,int X,int c){
  if(F[Y][X] != c){
    return;
  }
  
  F[Y][X] = -1;
  DFS(Y-1,X  ,c);
  DFS(Y  ,X+1,c);
  DFS(Y+1,X  ,c);
  DFS(Y  ,X-1,c);
}
  
  
int main(){
  int w,h,xs,ys,xg,yg,n;
  while(1){
    cin >> w >> h;
    if(w == 0 && h == 0)
      break;

    for(int i=0; i<102; i++){
      for(int j=0; j<102; j++){
        F[i][j]=0;
      }
    }
      
    cin >> xs >> ys >> xg >> yg >> n;
  
  
    for(int i=0;i<n;i++){
      int c,d,x,y;
      cin >> c >> d >> x >> y;
      if(d == 0){
        for(int j=0;j<4;j++){
          F[x+j][y] = c;
          F[x+j][y+1] = c;
        }
      } else {
        for(int j=0;j<4;j++){
          F[x][y+j] = c;
          F[x+1][y+j] = c;
        }
      }
    }

  if(F[xs][ys] == 0){
    cout << "NG" << endl;
  } else {
    DFS(xs,ys,F[xs][ys]);
  
    if(F[xg][yg] == -1){
      cout << "OK" << endl;
    } else {
      cout << "NG" <<endl;
    }
  }

}
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int cur=0;
	while(a>0||c>0){
		cur++;
		if(cur%2==1){
			c=c-b;
		}else{
			a=a-d;
		}
	}
	if(cur%2==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

int main() {
    int input_a, result;
    cin >> input_a;
    cin >> result;
    int answer = 0;
    for(int i = 0; i <= input_a; i++) {
        for(int b = 0; b <= input_a; b++) {
            int c = result - i - b;
            if(0 <= c && c <= input_a && result == (i + b + c)) {
                answer++;
            } 
        }
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    REP(i, 3) {
        string word;
        cin >> word;
        cout << word.at(0);
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

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

  ll x, y;
  cin >> x >> y;
  cout << x + y/2 << endl;
  return 0;
}

Measured memory_bytes: 256
N=gets.to_i
a=gets.chomp.split.map(&:to_i).sort
ps=Array.new(N)
ps[0]=a[0]
0.upto(N-2) do |i|
    ps[i+1] = ps[i] + a[i+1]
end

ans = 1
(N-2).downto(0) do |i|
    if ps[i] * 2 >= a[i+1]
        ans += 1
    else
        break
    end
end
puts ans

Measured memory_bytes: 11256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,sum=700;
    char s[4];
    cin>>s;
    for(i=0;i<3;i++){
        if(s[i]=='o'){
            sum=sum+100;
        }
    }
    cout<<sum<<endl;
    return 0;

}


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

int main() {
    int H, W;
    cin >> H >> W;
    char C[H + 2][W + 2];
    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            cin >> C[i][j];
        }
    }
    
    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            int count = 0;
            if (C[i][j] == '.') {
                for (int k = -1; k <= 1; k++) {
                    for (int l = -1; l <= 1; l++) {
                        if (C[i + k][j + l] == '#') {
                            count++;
                        }
                    }
                }
                C[i][j] = count + '0';
            }
            cout << C[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#define llt long long int

using namespace std;
int main()
{
    int x;
    cin >> x;

    int ureshi = 0;

    while (x >= 500) {
        ureshi += 1000;
        x -= 500;
    }

    while (x >= 5) {
        ureshi += 5;
        x -= 5;
    }

    cout << ureshi << endl;
}


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){

  int n;
  cin>>n;
  for(int cnt=0;cnt<n;cnt++){

  set <string> li;
  string s;
  cin>>s;

  for(int i=0;i<(int)s.size();i++){

    string s1,s2;
    s1=s.substr(0,i);
    s2=s.substr(i,(int)s.size()-i);

    // cout<<s1<<" "<<s2<<endl;

    li.insert(s1+s2);
    li.insert(s2+s1);

    reverse(s1.begin(),s1.end());

    li.insert(s1+s2);
    li.insert(s2+s1);

    reverse(s2.begin(),s2.end());

    li.insert(s1+s2);
    li.insert(s2+s1);

    reverse(s1.begin(),s1.end());

    li.insert(s1+s2);
    li.insert(s2+s1);

  }

  cout<<li.size()<<endl;

  }

  return 0;

}



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

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;

const int maxn = 2e3+1;

const int mod = 1e9+7;
ll d[maxn][maxn];
inline void Add(ll &x, ll y)
{
  if ((x += y) >= mod) x -= mod;
}
inline void Sub(ll &x, ll y)
{
  if ((x -= y) < 0) x += mod;
}

vector<int> read(int x)
{
  vector<int> ret(x);
  for (auto & e : ret) cin >> e;
  return ret;
}
int main()
{
  int n, m; cin >> n >> m;
  auto s = read(n);
  auto t = read(m);
  for (int i = 0; i < maxn; ++i)
    d[i][0] = d[0][i] = 1;
  for (int i = 1; i <= s.size(); ++i)
    for (int j = 1; j <= t.size(); ++j)
      {
	Add(d[i][j] = d[i-1][j], d[i][j-1]);
	if (s[i-1] != t[j-1]) Sub(d[i][j], d[i-1][j-1]);
	//	cerr << i << " " << j << " " << d[i][j] << endl;
      }
  printf("%lld\n", d[s.size()][t.size()]);
}


Measured memory_bytes: 31488
n, k = map(int, input().split())
a = list(map(int, input().split()))

MAX_DIGIT = 40

dp = [[-1, -1] for _ in range(MAX_DIGIT+1)]
dp[0][0] = 0
for i in range(MAX_DIGIT):
    mask = 1 << (MAX_DIGIT - i - 1)
    cnt_1 = 0
    for v in a:
        if v & mask:
            cnt_1 += 1
    cnt_0 = n - cnt_1

    cost_0 = mask * cnt_1
    cost_1 = mask * cnt_0

    if dp[i][1] != -1:
        dp[i+1][1] = max(dp[i+1][1], dp[i][1] + max(cost_0, cost_1))

    if dp[i][0] != -1:
        if k & mask:
            dp[i+1][1] = max(dp[i+1][1], dp[i][0] + cost_0)
    
    if dp[i][0] != -1:
        if k & mask:
            dp[i+1][0] = max(dp[i+1][0], dp[i][0] + cost_1)
        else:
            dp[i+1][0] = max(dp[i+1][0], dp[i][0] + cost_0)

print(max(dp[MAX_DIGIT][0], dp[MAX_DIGIT][1]))

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

// templates -------------------------------------

#define ULL unsigned long long
#define LL long long
#define LLD long long double
#define REP(i, n) for(LL i = 0; i < n; i++)
#define INV_REP(i, n) for(LL i = n; 0 <= i; i--)

LL combination(LL n, LL m)
{
  LL nume = 1;
  REP(i, m) nume *= (n-i);
  LL demo = 1;
  for(int i = 1; i <= m; i++) demo *= i;
  return nume / demo;
}

template<class T>
class UnionFind
{
private:
  vector<T> par;
  vector<T> rank;
  vector<T> size;

public:
  UnionFind(T N) :
    par(N, T()), rank(N, T()), size(N, T())
  {
    REP(i, N)
    {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  inline T root(T x)
  {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  inline bool same(T x, T y)
  {
    return root(x) == root(y);
  }

  inline T getSize(T x)
  {
    return size[root(x)];
  }

  void unite(T x, T y)
  {
    T r1 = root(x);
    T r2 = root(y);
    if(r1 == r2) return;

    if(rank[r1] < rank[r2]) swap(r1, r2);
    if(rank[r1] == rank[r2]) rank[r1]++;
    par[r2] = r1;
    size[r1] += size[r2];
  }
};

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

int a, b;

void input()
{
  cin >> a >> b;
}

void solve()
{
  int sum = 0;
  REP(i, 2)
  {
    if(a <= b)
    {
      sum += b;
      b--;
    }
    else
    {
      sum += a;
      a--;
    }
  }
  cout << sum << endl;
}

int main()
{
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

N, M, L = inpl()
graph = [[0]*N for _ in range(N)]
for i in range(M):
    A, B, C = inpl()
    if C <= L:
        graph[A-1][B-1] = C

Q = int(input())
ST = []
for _ in range(Q):
    s, t = inpl()
    s -= 1
    t -= 1
    ST.append((s, t))

distance = floyd_warshall(csr_matrix(graph), directed=False)
path = [[0]*N for _ in range(N)]
for i in range(N-1):
    for j in range(i+1,N):
        d = distance[i][j]
        if d <= L:
            path[i][j] = 1
ans = floyd_warshall(csr_matrix(path), directed=False)
for s, t in ST:
    if ans[s][t] == np.float('inf'):
        print(-1)
    else:
        print(int(ans[s][t]-1))


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

int main(){

	int n, lucro = 0;
	scanf("%d", &n);
	vector<int> v(n), c(n);

	rep(i,n) scanf("%d", &v[i]);
	rep(i,n){

		scanf("%d", &c[i]);
		if (v[i]>c[i]) lucro += v[i]-c[i];
	
	}
	printf("%d\n", lucro);
	return 0;
}

Measured memory_bytes: 3692
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  char s[27];
  scanf("%s",s);
  int len=0;
  while(s[len]!='\0') len++;
  if(len<26){
    char c='a';
    while(1){
      int i;
      for(i=0;i<len;i++){
	if(c==s[i]) break;
      }
      if(i==len){
	s[len]=c;
	s[len+1]='\0';
	printf("%s",s);
	return;
      }
      c++;
    }
  } else {
    int f[26];
    int i;
    for(i=0;i<26;i++) f[i]=0;
    for(i=len-1;i>=0;i--){
      int j;
      for(j=s[i]-'a'+1;j<26;j++){
	if(f[j]){
	  s[i]='a'+j;
	  printf("%s\n",s);
	  return;
	}
      }
      f[s[i]-'a']=1;
      s[i]='\0';
    }
  }
  printf("-1\n");
  return;
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	while(cin >> n and n!=0)
	{
		int f=1;
		int s=1;
		int cnt=0;
		int sum=1;
		while(true)
		{
			if(s>=n)break;
			if(sum>n)
			{
				sum-=f;
				f++;
			}
			else if(sum<n)
			{
				s++;
				sum+=s;
			}
			else if(sum==n)
			{
				cnt++;
			//cerr << sum << " " << f << " " << s <<  endl;
				sum-=f;
				f++;
			}

		}
		cout << cnt << endl;

	}
}



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

int main() {
	int n, x;
	while (cin >> n >> x, n || x) {
		int ans = 0;
		for (int i = 1; i <= n - 2; i++) {
			for (int j = i + 1; j <= n - 1; j++) {
				int k = x - i - j;
				if (k < j + 1 || n < k) continue;
				if (i == k || j == k) continue;
				ans++;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3088
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
typedef long long ll;
using namespace std;
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
inline int rd(){
	int res=0,sign=1;char ch;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')sign=-1;res=res*10+ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	return res*sign;
}
int n;
int main(){
	cin>>n;
	cout<<"ABC"<<n<<endl;
	return 0;
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    int64_t n = s.size();

    int64_t ans = 1;
    vector<int64_t> nums('z' - 'a' + 1);
    for (auto i : irange(0L, n)) {
        int64_t c = s[i] - 'a';

        ans += i - nums[c];

        ++nums[c];
    }

    cout << ans << endl;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

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

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

ll f(ll x) {
    ll ret = 0, len = 1;
    REP(i, 40) {
        if(i==0) {
            if(x%4==1 || x%4==2) {
                ret |= 1LL<<i;
            }
        } else {
            if(x%(2*len) >= len && x%2==0) {
                ret |= 1LL<<i;
            }
        }
        len *= 2;
    }
    return ret;
}

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

    ll a, b;
    cin >> a >> b;
    cout << (f(b) ^ (a==0?0:f(a-1))) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int a[10];
  int i, j, index, max;
  int cnt = 0;

  for(i = 0; i < 10; i++) {
	scanf("%d", &a[i]);
  }

  max = a[0];
  
  while(cnt < 3) {
	for (i = 0; i < 10; i++) {
	  for (j = i + 1; j< 10; j++) {
		if(max < a[j]) {
		  max = a[j];
		  index = j;
		  break;
		}
	  }
	}
	printf("%d\n", max);
	a[index] = 0;
	max = 0;
	cnt++;
  }

  return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;


const ll mod = (ll)1e9 + 7;
const ll mxN = 1000003;


ll mm = 1e18;

ll f(ll m) {
	return ll((sqrtl(8*m+1)-1)/2);
}

vector<bool> prime(mxN,true);
void solve() {
	ll n;cin>>n;
	vll ans;
	ll ans1=0;
	for(ll i=2;i<=mxN;i++)
		if(prime[i])
		{
			if(n%i==0)
				ans.pb(i);
			for(ll j=i*i;j<=mxN;j+=i)
				prime[j]=false;
		}
	for(auto i: ans) {
		ll x=0;
		while(n%i==0)
			x++,n/=i;
		ans1+=f(x);
	}
	if(n>1) ans1++;
	cout<<ans1<<"\n";
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

//	pre();
//	ll t;cin>>t;while (t--)
		solve();
}


Measured memory_bytes: 3800
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main()
{
    std::string s, t; std::cin >> s >> t;
    int count = 0;
    for(int i=0; i<3; i++)
    {
        if(s[i] == t[i]) count++;
    }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <assert.h>

using namespace std;

const int N=3010;

int n,P,fac[N],inv[N],f[N][N];

inline void Pre(const int &n){
  fac[0]=1; for(int i=1;i<=n;i++) fac[i]=1LL*fac[i-1]*i%P;
  inv[1]=1; for(int i=2;i<=n;i++) inv[i]=1LL*(P-P/i)*inv[P%i]%P;
  inv[0]=1; for(int i=1;i<=n;i++) inv[i]=1LL*inv[i-1]*inv[i]%P;
}

inline int C(int x,int y){
  if(x==-1 && y==-1) return 1;
  return 1LL*fac[x]*inv[y]%P*inv[x-y]%P;
}

inline int Pow(int x,int y,int p=P){
  int ret=1;
  for(;y;y>>=1,x=1LL*x*x%p) if(y&1) ret=1LL*ret*x%p;
  return ret;
}

int main(){
#ifdef ljn
  freopen("1.in","r",stdin);
  freopen("1.out","w",stdout);
#endif
  cin>>n>>P; Pre(3000);
  int ans=0;
  f[0][0]=1;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=i;j++)
      f[i][j]=(f[i-1][j-1]+1LL*j*f[i-1][j])%P;
  }
  
  for(int i=0;i<=n;i++){
    int cur=1,t=Pow(2,n-i);
    /*for(int j=1;j<=i;j++){
      int c=0;
      //c=Pow(t,j);
      for(int k=1;k<=j;k++)
	c=(c+1LL*f[j][k]*Pow(t,k))%P;
      cur=(cur+1LL*c*C(i,j))%P;
    }
    */
    for(int k=1;k<=i;k++){
      int c=(f[i][k]+1LL*f[i][k+1]*C(k+1,k))%P;
      //for(int j=k;j<=i;j++)
      //c=(c+1LL*f[j][k]*C(i,j))%P;
      assert(c==(f[i][k]+1LL*f[i][k+1]*C(k+1,k))%P);
      cur=(cur+1LL*Pow(t,k)*c)%P;
    }
    //for(int k=1;k<=i;k++)
    //  c=(c+1LL*Pow(t,k)*(f[n][k]-f[k-1][k]))%P;
    cur=1LL*cur*C(n,i)%P*Pow(2,Pow(2,n-i,P-1))%P;
    if(i&1) ans=(ans-cur)%P;
    else ans=(ans+cur)%P;
  }
  printf("%d\n",(ans+P)%P);
  return 0;
}
 


Measured memory_bytes: 34304
/*
      @author: Charan Sai
*/
#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define ppi pair<int, int>
#define endl "\n"
#define nl cout << "\n"
#define deb(x) cout << #x << " " << x << endl;

const int MAX_N=3005;
int arr[MAX_N];
int n;
int dp[MAX_N][MAX_N][2]; 
// dp[i][j][0] = Max (X - Y) for subsequence arr[i...j] when it is 0th player turn. Whatever he chooses add it in X
// dp[i][j][1] = Max (X - Y) for subsequence arr[i...j] when it is 1st player turn. Whatever he chooses add it in Y
int Top_Down(int start = 1, int end = n, int turn = 0) {
    // Base Case
    if(start == end) {
        if(turn == 0) return arr[start];
        return -arr[start];
    }
    if(dp[start][end][turn]!=-1) return dp[start][end][turn];
    // Choice
    int l = Top_Down(start+1, end, !turn);
    int r = Top_Down(start, end-1, !turn);
    if(turn == 0) {
        return 
        (dp[start][end][turn]=max(arr[start]+l,
                    arr[end]+r));
    }
    return 
    (dp[start][end][turn] = min(l-arr[start], r-arr[end]));
}

/*
dp[i][j][1] = Max (X - Y) for subsequence arr[i...j] when it is 1st player turn. Whatever he chooses add it in Y
This is unnecessary. So try to do it without storing 'turn'.
X1 - (Y1 - (X2 - Y2)) = (X1 + X2) - (Y1 + Y2)
Since the - sign alternates so we no need turn.
*/
int dp2[MAX_N][MAX_N];
//dp[i][j] = Max(X-Y) for subsequence arr[i..j]
//when it is 0th player turn to choose
int Top_Down2(int start = 1, int end = n) {
    // Base Case
    if(start == end) {
        return arr[start];
    }
    if(dp2[start][end] != -1) return dp2[start][end];
    // Choice
    return (dp2[start][end]=
        max(arr[start]-Top_Down2(start+1,end),arr[end]-Top_Down2(start,end-1))
    );
}

int32_t main() {
    IOS;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    memset(dp2, -1, sizeof(dp2));
    for(int i = 1; i <= n; ++i) cin >> arr[i];
    cout << Top_Down2();
}

Measured memory_bytes: 212096
#!/usr/bin/perl
#= CPAN mocules =====================================================#
use strict;				# strictモード
use warnings;			# 警告有効

#= Global values ====================================================#
#= Local routines ===================================================#
sub main(){
	my $in = <>;
	chomp $in;

	if ($in =~ /7/){
		print "Yes\n";
	}else{
		print "No\n";
	}

	return 0;
}

#----- 実行 -----#
exit( main() );




Measured memory_bytes: 5108
#include<set>
#include<map>
#include<stack>
#include<ctime>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;      
LL read(){      
    LL f=1,x=0;char s=getchar();         
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}        
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}      
    return f*x; 
}
int main(){
	LL a=read(),b=read();
	if(a<=0&&b>=0){
		puts("Zero");
		return 0;
	}
	if(a>0||(b-a)%2)
		puts("Positive");
	else puts("Negative");
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <complex>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define puts(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);


void solve(void){
	int x1, y1, x2, y2, q;
	cin >> x1 >> y1 >> x2 >> y2 >> q;

	double dx = x2 - x1, dy = y2 - y1, norm = sqrt(dx*dx+dy*dy);

	while(q--)
	{
		int x3, y3;
		cin >> x3 >> y3;

		double ax, ay, naiseki;

		naiseki = (x3-x1) * dx + (y3-y1) * dy;

		ax = x1 + dx * naiseki / norm / norm;
		ay = y1 + dy * naiseki / norm / norm;

		printf("%.12lf %.12lf\n", ax, ay);
	}


}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3212
S = input()
Q = int(input())

buf = [0] * (3*(10**5)+10)
for i, s in enumerate(S):
    buf[i] = s

is_reverse = False
first = 0
last = len(S) - 1

def add_top(c):
    global buf
    global first
    if is_reverse:
        first += 1
    else:
        first -= 1
    buf[first] = c

def add_tail(c):
    global buf
    global last
    if is_reverse:
        last -= 1
    else:
        last += 1
    buf[last] = c

for i in range(Q):
    Query = input().split()
    t = int(Query[0])
    if t == 1:
        is_reverse = not is_reverse
        first, last = last, first
    else:
        f = int(Query[1])
        c = Query[2]
        if f == 1:
            add_top(c)
        else:
            add_tail(c)

ans_list = []
p = first
while True:
    ans_list.append(buf[p])
    if p == last:
        break
    if is_reverse:
        p -= 1
    else:
        p += 1
ans = ''.join(ans_list)
print(ans) 


Measured memory_bytes: 90052
#define _CRT_SECURE_NO_WARNINGS
 
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>
 
#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
 
const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;
 
int main() {
	int R;
	cin >> R;
	if (R < 1200) cout << "ABC";
	else if (R < 2800) cout << "ARC";
	else cout << "AGC";
	system("pause");
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<long> v(n);
  for(int i=0;i<n;i++){cin >> v.at(i);}
  vector<long> b(n+1,0);
  for(int i=0;i<n;i++){b.at(i+1) = v.at(i)+b.at(i);}

  sort(b.begin(),b.end());
  b.push_back(10000000000);
  vector<long> p;
  long num = 0;

  for(int i=0;i<b.size()-1;i++){
      if(b.at(i)!=b.at(i+1)){
          p.push_back(i+1-num);
          num = i+1;
        }
  }
    long ans = 0;
    for(int i=0;i<p.size();i++){
        ans += (p.at(i)*(p.at(i)-1))/2;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  int keta1=s[0]-'0';
  int keta2=s[1]-'0';
  int keta3=s[2]-'0';
  int keta4=s[3]-'0';
  char kigou1='+';
  char kigou2='+';
  char kigou3='+';
  if(keta1+keta2+keta3+keta4==7){
  }else if(keta1+keta2+keta3-keta4==7){
    kigou3='-';
  }else if(keta1+keta2-keta3-keta4==7){
    kigou2='-';
    kigou3='-';
  }else if(keta1-keta2-keta3-keta4==7){
    kigou1='-';
    kigou2='-';
    kigou3='-';
  }else if(keta1+keta2-keta3+keta4==7){
    kigou2='-';
  }else if(keta1-keta2-keta3+keta4==7){
    kigou1='-';
    kigou2='-';
  }else if(keta1-keta2+keta3-keta4==7){
    kigou1='-';
    kigou3='-';
  }else if(keta1-keta2+keta3+keta4==7){
    kigou1='-';
  }  
  cout<<keta1<<kigou1<<keta2<<kigou2<<keta3<<kigou3<<keta4<<"=7"<<endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  ll i,N,M,a,b,ans=0;
  cin>>N;
  M=N/2;
  ans=2*(M-1)*M;
  if(N%2){
    ans+=N-1;
  }
  cout<<ans<<endl;
  if(N%2){
    rep1(i,N){
      cout<<i<<" "<<N<<endl;
    }
    N--;
  }
  a=1;b=N;
  while(b-a>1){
    For(i,a+1,b){
      cout<<i<<" "<<a<<endl;
      cout<<i<<" "<<b<<endl;
    }
    a++;b--;
  }
  return 0;
}

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

int main()
{
    int h, w;
    while (cin >> h >> w, h || w)
    {
        for (int i = 0; i < h; ++i)
        {
            for (int j = 0; j < w; ++j)
            {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define reps(i, n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    const int MOD=1000000007;
    
    string s;
    cin>>s;
    int n=s.size();
    vector<vector<ll>> dp(n+100,vector<ll>(13)); //dp[i][j]->i文字目まででSがjと合同となるような?の埋め方
    dp.at(0).at(0)=1;
    rep(i,n){
        rep(j,13){
            if(s.at(i)!='?'){
                int x=s.at(i)-'0';
                dp.at(i+1).at((10*j+x)%13)+=dp.at(i).at(j);
                dp.at(i+1).at((10*j+x)%13)%=MOD;
            }
            else{
                rep(k,10){
                    dp.at(i+1).at((10*j+k)%13)+=dp.at(i).at(j);
                    dp.at(i+1).at((10*j+k)%13)%=MOD;
                }
            }
        }
    }
    
    cout<<dp.at(n).at(5)<<endl;
    
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2087;
ll dp[N][N];
pair<int, int> a[N];
int main()
{
    ll n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].first;
        a[i].second = i + 1;
    }
    sort(a, a + n);
    for (int w = 1; w <= n; ++w) {
        int x, v;
        v= a[w - 1].first;
		x = a[w -1].second;
        for (ll l = 1, r = l + w - 1; r <= n; ++l, ++r) 
            dp[l][r] = max(dp[l + 1][r] + v * abs(l - x), dp[l][r - 1] + v * abs(r - x));
    }
    cout << dp[1][n] << endl;
}

Measured memory_bytes: 26576
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var S = ReadLine();
        var K = long.Parse(ReadLine());

        var oneCount = S.TakeWhile(c => c == '1').Count();
        var nextNum = oneCount < S.Length ? (S[oneCount] - '0') : -1;

        var ans = (K <= oneCount) ? 1 : nextNum;

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 27684
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int h,w,n;
	cin>>h>>w>>n;
	cout<<min((n+h-1)/h,(n+w-1)/w);
	return 0;
}


Measured memory_bytes: 256