akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <time.h>
#include <complex>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;
using std::complex;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::min;
using std::max;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;
typedef complex<double> cd;

namespace MySpace{
    struct Small_Segment_Tree{
        vector<int> a;
        int l, r;

        private:
        int __summ(int L, int R, int l, int r, int v)
        {
            if (L <= l && r <= R)
                return a[v];
            if (R <= l || r <= L)
                return 0;
            int m = (l + r) / 2;
            return __summ(L, R, l, m, 2 * v + 1) + __summ(L, R, m, r, 2 * v + 2);
        }

        void __set(int P, int l, int r, int v, int V)
        {
            if (l + 1 == r)
            {
                a[v] = V;
                return;
            }
            int m = (l + r) / 2;
            if (P < m)
            {
                __set(P, l, m, 2 * v + 1, V);
                a[v] = a[2 * v + 1] + a[2 * v + 2];
            }
            else
            {
                __set(P, m, r, 2 * v + 2, V);
                a[v] = a[2 * v + 1] + a[2 * v + 2];
            }
        }

        public:
        int Summ(int L, int R)
        {
            if (R < L)
                return 0;
            return __summ(L, R + 1, l, r, 0);
        }

        void Set(int P, int V)
        {
            __set(P, l, r, 0, V);
        }

        Small_Segment_Tree(int _n)
        {
            a.resize(4 * _n);
            l = 0, r = _n;
        }
    };
    long long inq(long long x, long long q, long long MOD)
    {
        if (q == 0)
            return 1;
        long long l = inq(x, q / 2, MOD);
        if (q % 2)
            return l * l % MOD * x % MOD;
        return l * l % MOD;
    }
};


using namespace MySpace;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const ll MOD = 1e9 + 7;
ll cnt[500];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    S s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
        cnt[s[i]]++;
    ll k = 0;
    for (int i = 0; i < 255; i++)
        k += cnt[i] > 0;
    if (k == 2)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public Main() {
    }

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

    private void solve() {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println((X - A) - (X - A) / B * B);
    }
}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int s ;
    cin>>s;
    if(s <= 1000000000){
        cout<<0<<" "<<0<<" "<<1<<" "<<0<<" "<<0<<" "<<s<<endl;
    }else if(s < 1000000000000000000){
        int x2 = (s / 1000000000) + 1;
        int y3 = 1000000000;
        int x3 =  1000000000 - (s % 1000000000);
        int y2 = 1;
        cout<<0<<" "<<0<<" "<<x2<<" "<<y2<<" "<<x3<<" "<<y3<<endl;
    }else {
        cout<<0<<" "<<0<<" "<<1000000000<<" "<<0<<" "<<0<<" "<<1000000000<<endl;
    }

}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;

typedef unsigned long long ll;

const long long MOD = 1000000000 + 7;

//For DP
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;
}

//Union-Find tree
struct UnionFind{
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N;  i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る : root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y) { //xとyの木を併合
        int rx = root(x); //xの木の根をrx
        int ry = root(y); //yの木の根をyx
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)ときはそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時 : xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};



int main(){
    int N,M,X;
    cin >> N >> M >> X;
    vector<int> C;
    vector<vector<int>> A;
    rep(i,N){
//        int c;
//        cin >> c;
//        C.push_back(c);
        vector<int> a;
        int tmp;
        rep(j,M+1){
                cin >> tmp;
                a.push_back(tmp);
        }
        A.push_back(a);
    }
    queue<vector<int>> que;
    vector<int> nin;
    nin.push_back(0);
    rep(i,M) nin.push_back(0);
    que.push(nin);
    set<int> rslt;
    rep(i,N){
        auto que2 = que;
        while(!que2.empty()){
            vector<int> now = que2.front();
            que2.pop();
            bool fin = true;
            rep(j,now.size()){
                now[j] += A[i][j];
                if(j==0) continue;
                if(now[j] < X) fin = false;
            }
            if (fin == true) rslt.insert(now[0]);
            else que.push(now);
        }
    }
    if(rslt.empty()) cout << -1 << endl;
    else cout << *rslt.begin() << endl;
    return 0;
}


Measured memory_bytes: 4000
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll k; cin >>k;
  string s; cin >>s;
  if(s.size()<=k){
    cout  <<s<<endl;
    return 0;
  }
  rep(i,k) cout <<s[i];
  cout <<"..."<<endl;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  string s;cin>>s;
  // vector<string>v(s.size());
  // rep(i,0,s.size())v[i]=s[i];

  ll ma=0;char c;
  set<char>se;
  rep(i,0,s.size()){
    se.insert(s[i]);
    // ll num=count(v.begin(),v.end(),v[i]);
    // if(ma<=num){
    //   se.insert(c);
    //   c=s[i];
    //   ma=num;
    // }
  }
  // cout<<c<<":"<<ma<<endl;
  ll ans=INF;
  string t=s;
  bool e=false;
  for(set<char>::iterator itr=se.begin();itr!=se.end();itr++){
    c=*itr;
    t=s;
    ll count=0;
    while(1){
      e=true;
      rep(i,0,t.size()-1){
        if(t[i]!=t[i+1]){
          e=false;
          break;
        }
      }
      if(!e){
        string a="";
        rep(i,0,t.size()-1){
          if(t[i]==c)a+=t[i];
          else if(t[i+1]==c)a+=t[i+1];
          else a+=t[i];
        }
        t=a;
        count++;
        // cout<<ans<<":"<<t<<endl;
      }else{
        ans=min(ans,count);
        break;
      }
    }
  }

  out(ans);

  return 0;
}


Measured memory_bytes: 256
(let* ((n (read))
       (lst nil))
  (setf lst (loop :for k :from 1 :upto (ceiling (sqrt n)) :collect k))
  (setf lst (remove-if-not (lambda (k) (= 0 (mod n k))) lst))
  (princ (- (apply #'min (mapcar (lambda (k) (+ k (/ n k))) lst)) 2)))

Measured memory_bytes: 22240
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
		String JOIOI = sc.next();
		int JOI = 0,IOI = 0;
		for(int i = 0; i < JOIOI.length() - 2; i++){
			if(JOIOI.substring(i, i + 3).equals("JOI"))
				JOI++;
			if(JOIOI.substring(i, i + 3).equals("IOI"))
				IOI++;;
		}
		System.out.println(JOI);
		System.out.println(IOI);
		}
		sc.close();
	}
}

Measured memory_bytes: 24036
import math
n = int(input())

for i in range(int(n/4) + 1):
    for j in range(int((n-4*i)/7) + 1):
        #print("4:{} 7:{} {}".format(i, j, 4*i+7*j))
        if 4*i + 7*j == n:
            if 4*i+7*j <= n:
                print("Yes")
                exit()
print("No")

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MIN(a,b) (((a)<(b)) ? (a) : (b))
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
#define N 1000

void overflow()
{
  printf("overflow");
}
int main(){
  int h,n;
  scanf("%d",&n);
  for(h=0;h<n;h++)
    {
      char s1[N],s2[N];
      int sum[N],g;
      for(g=0;g<N;g++) sum[g]=0;
      scanf("%s %s",s1,s2);
      int l1, l2;
      l1 = strlen(s1);
      l2 = strlen(s2);
      if(MAX(l1,l2)>80) overflow();
      else 
	{
	  int i,j=l1,k=l2;
	  for(i=0;i<MAX(l1,l2);i++)
	    {
	      int tmp;
	      if(j>0 && k>0) tmp = s1[--j] + s2[--k] - 2 * '0';
	      else if(j==0 && k==0) tmp = s1[j] + s2[k];
	      else if(j==0) tmp = s2[--k] - '0';
	      else if(k==0) tmp = s1[--j] - '0';
	      if(tmp+sum[i] > 9) sum[i+1]++;
	      sum[i] = (sum[i]+tmp)%10;
	    }
	  if(sum[80]>0) overflow();
	  else 
	    {
	      int m = 80;
	      while(sum[--m]==0&&m>0);
	      for(;m>=0;m--) printf("%d",sum[m]);
	    }
	}
      printf("\n");
    }
  return 0;
}

Measured memory_bytes: 604
import collections

N=int(input())
data=[input() for i in range(N)]
c = collections.Counter(data)
score=c
com=c.most_common()

score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True)

val=score_sorted
L=len(val)
count="Yes"
ii=0
ansa=1
if L==1:
    print(val[0][0])
else:
    while count=="Yes":
        if val[ii][1]==val[ii+1][1]:
            ii+=1

            ansa+=1
            if ii == L-1:
                break
        else:
            count="No"
    data2=[]
    for i in range(ansa):
        data2.append(val[i][0])

    data2.sort()
    for i in range(ansa):
        print(data2[i])

Measured memory_bytes: 61936
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> p;
    for(int i=0;i<n;i++){
        int val;
        cin>>val;
        p.push_back(val);
    }
    vector<int> q=p;
    sort(q.begin(),q.end());
    int c=0;
    if(q==p)
    {
        cout<<"YES"<<'\n';
        return 0;
    }
    vector<int> a;
    for(int i=0;i<n;i++){
        if(q[i]!=p[i])
        {
            c++;
            a.push_back(i);
        }
        if(c==2)
            break;
    }
    swap(p[a[0]],p[a[1]]);
    if(q==p)
        cout<<"YES"<<'\n';
    else
        cout<<"NO"<<'\n';
    return 0;
}


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

using namespace std;

int main()
{
    long long int n,i,a,b,max1,ans=0,ci=0;
    int flag=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a>>b;
        if(flag==0&&a>b)
        {
             max1=b;
             flag=1;
        }
        if(a==b)ci++;
        ans+=a;
        if(a>b)
        {
            if(b<max1)
            max1=b;
        }
    }
    if(ci==n)
    {
        printf("0\n");
    }
    else
    {
        ans-=max1;
       cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, k; cin >> n >> k;
  vector<ll> A(n), sum(n+1);
  rep(i, n) {
    cin >> A[i];
    sum[i+1] = sum[i] + A[i];
  }
  rep(i, n+1) sum[i] -= k*i;
  vector<pair<ll, int>> v;
  rep(i, n+1) v.push_back({sum[i], i});
  sort(all(v));
  BinaryIndexedTree<int> bit(n+1);
  ll ans = 0;
  rep(i, n+1) {
    ans += bit.sum(v[i].second);
    bit.add(v[i].second, 1);
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 10536
#include<bits/stdc++.h>
using namespace std;
int main(){
	string S;
	cin>>S;
	if((S.size()&1) || S.size()==0) return puts("No"),0;
	for(int i=0;i<S.size();++i)
		if(S[i]!='h'&&S[i]!='i') return puts("No"),0;
	for(int i=0;i<S.size();++i){
		char ch=(i&1)?'i':'h';
		if(ch!=S[i]) return puts("No"),0;
	} 
	cout<<"Yes";
	return 0;
} 

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
 long long r,d,x,X;
  cin >> r >> d >> x;
  for(int i=0; i<10; i++) {
    X=r*x-d;
    cout << X << endl;
    x=X;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long int
#define M 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
const int INF = 1e18L+5;
const int LG = 20;
const int N = 1e5+9;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int power(int x,int y){int res=1;while(y>0){if(y%2==1)res=(res*x)%M;x=(x*x)%M;y=y/2;}return res;}
bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}
int32_t main()
{
	//cout.precision(15);
	//cout.setf(ios::fixed,ios::floatfield);
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int T=1;
	//cin>>T;
	while(T--)
	{
		int w,s;
		cin>>s>>w;
		if(w>=s)
		cout<<"unsafe"<<endl;
		else
		cout<<"safe"<<endl;
	}
}


Measured memory_bytes: 3648
program anti_division
    implicit none
    integer(8):: a,b,c,d,gcd,ans_a, ans_b

    read*, a,b,c,d

    gcd = c*d/lcm(c,d)

    ans_a = (a-1) - (a-1)/c - (a-1)/d +(a-1)/gcd
    ans_b = b - b/c - b/d + b/gcd

    print*, ans_b - ans_a

contains
recursive function lcm(a,b) result(ret)
    integer(8),intent(in):: a,b
    integer(8):: ret

    if (mod(a,b) == 0) then
        ret = b
        return
    end if
    ret = lcm(b,mod(a,b))
end function
end program anti_division

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

    int N; cin >> N;
    ll x; cin >> x;
    ll A[110]; rep(i, N) cin >> A[i];

    sort(A, A + N);
    int ans = 0;

    rep(i, N) {
        if(i == N - 1 && A[i] != x) {
            break;
        }
        if(x - A[i] >= 0) {
            x -= A[i];
            ans ++;
        } else {
            break;
        }
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define reep(i,n) for(ll i = n; i >-1; i--)
#define deb(variable) cout<<#variable<<"="<<variable<<endl
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999999;
const ll MOD=998244353;
const ll MAX_N=100010;
ll a,b,d,e,x,y,z,k,m,n,l,q,h,w,t,ans=0;
vl v,v1,v2,anss(200000,0);
vl gragh[200000];
priority_queue<int, vector<int>, greater<int> > que;
char c;
string s1,s2;
ll solve(void){
    while(!v1.empty()){
        v2=vl(0);
        rep(i,v1.size()){
        	t=v1[i];
            a=que.top();
            que.pop();
            anss[t]=a;
            rep(j,gragh[t].size()){
                if(v[gragh[t][j]]>0)k=gragh[t][j];
            }
            v[k]--;
            v[t]--;
            if(v[k]==1)v2.push_back(k);
        }
        v1=v2;
    }
 
    for(ll i=1;i<n+1;i++){
        rep(j,gragh[i].size()){
            a=anss[gragh[i][j]];
            b=anss[i];
            ans+=fminl(a,b);
        }
    }
 
    cout<<ans/2<<endl;
    for(ll i=1;i<n+1;i++){
        cout<<anss[i];
        if(i!=n)cout<<" ";
    }
 
    return 0;
}
int main(){
    cin>>n;
 
    v=vl(200000,0);
    rep(i,n-1){
        cin>>a>>b;
        v[a]++;
        v[b]++;
        gragh[a].push_back(b);
        gragh[b].push_back(a);
    }
 
    rep(i,n+1){
        if(v[i]==1)v1.push_back(i);
    }
 
    rep(i,n){
        cin>>a;
        que.push(a);
    }
 
    solve();
 
}

Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void){
  int N,M;
  cin >> N >> M;
  string str;
  cin >> str;
  int loc = N;
  vector<int> v;
  while(loc > 0){
    int n=M;
    for(n=M;n>=1;n--){
      if(loc - n >= 0){
        if(str[loc - n] == '0')
          break;
      }
    }
    if(n == 0){
       cout << -1 << endl;
       return 0;
    }
    v.push_back(n);
    loc = loc - n;
    //cout << loc << " "<< str[loc] << endl;
  }
  for(int i=v.size()-1;i>=1;i--){
    cout << v[i] << " ";
  }
  cout << v[0] << endl;
  return 0;
}

Measured memory_bytes: 3964
n=int(input())

lista=[]

for i in range(n): 
	s,p = map(str,input().split())
	p=int(p)
	lista.append([s,p,i+1])
	
	
#print(lista)
	
lista.sort(key=lambda x:-x[1])
#print(lista)

lista.sort(key=lambda x:x[0])
#print(lista)

ans=0
list_ans=[]
for i in range(n):
	ans=lista[i][2]
	list_ans.append(ans)

for i in range(n):
	print(list_ans[i])
	
	

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


void solve(long long N){
  int c = 0;
  for (int i = 1; i <= N; i++) {
    if (to_string(i).length() % 2 == 1) c++;
  }
  cout << c << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
/**
 *   created: 09 August 2019  11:55:44
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
vector< vi > adj;
vi comp,vis;

int dfs(int node){
	// trace1(node);
	vis[node] = 1;
	// comp[node] = 1;
	int res = 1;
	for(int x : adj[node]){
		if(!vis[x])
			res += dfs(x);
	}
	return res;
}

int main()
{
	optimizeIO();
	int tt=1;
	// cin>>tt;
	while(tt--){
		int a,b;
		cin>>a>>b;
		cout<<max(a*b,max(a-b,a+b));
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
multiset<int> s;
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		int x; cin>>x;
		auto it = s.lower_bound(x);
		if(it!=s.begin()) {
			it--;
			s.erase(it);
		}
		s.insert(x);
	}
	cout<<(int)s.size()<<endl;
	return 0;
}


Measured memory_bytes: 4992
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

def lamp(A):
  B = [0] * N
  for i in range(N):
    l = max(0, i - A[i])
    r = min(N - 1, i + A[i])
    #print(l, r)
    B[l] += 1
    if r + 1 < N:
      B[r + 1] -= 1
  
  A[0] = B[0]
  for i in range(1, N):
    A[i] = A[i - 1] + B[i]
  return A

x = int(math.log(N, 2)) + 40
r = min(x, K)
for i in range(r):
  A = lamp(A)
  
for i in range(N):
  print(A[i], end = " ")
print("")


Measured memory_bytes: 170204
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n;
	cin >> n;
	cout << n * n * n << endl;
	return 0;
}


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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn=new Scanner(System.in);
		int a=stdIn.nextInt();
		int b=stdIn.nextInt();
		int c=stdIn.nextInt();
		if(a-b==b-c)
			System.out.println("YES");
		else
			System.out.println("NO");
		
		

	}

}

Measured memory_bytes: 22484
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
#define MOD 7007
struct QUEUE
{
	int a,b,c,tot;
}Push;
int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};
vector<int> Hash[MOD];
bool HASH(int n)
{
	for(int i=0;i<Hash[n%MOD].size();i++)
		if(n==Hash[n%MOD][i])
			return false;
	Hash[n%MOD].push_back(n);
	return true;
}
int main()
{
	Push.tot=0;
	queue<QUEUE> que;
	scanf("%d%d%d",&Push.a,&Push.b,&Push.c);
	que.push(Push);
	while(!que.empty())
	{
		QUEUE Fro=que.front();
		if(Fro.a==Fro.b && Fro.b==Fro.c)
		{
			printf("%d\n",Fro.tot);
			return 0;
		}
		for(int i=0;i<6;i++)
		{
			Push=Fro;
			Push.tot++;
			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];
			int n=Push.a*10000+Push.b*100+Push.c;
			if(!HASH(n)) continue;
			que.push(Push);
		}
		que.pop();
	}
	return 0;
}


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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;

int main(){
    ll n; cin >>n;
    ll ans = n * (n-1) /2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# Your code here!
n = gets.to_i

ary = readlines.map(&:to_i)

a = ary.index(ary.max) +1

ary.sort!
i = 0

n.times do
    i+= 1
    if(i == a)
       p ary[-2]
    else
       p ary[-1] 
    end
end


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

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    int mn = min(a, k);
    ans += mn;
    k-=mn;
    mn = min(b, k);
    k-=mn;
    mn = min(c, k);
    ans -= mn;
    cout << ans << endl;
    return 0;
}

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


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

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <ext/pb_ds/priority_queue.hpp>
#define ll long long
#define MAXN 100005
using namespace std;
typedef pair<int,int> pii;
template <typename T>
inline void read(T& a)
{
	T ret(0),f(1);char ch(getchar());
	while(ch < '0' || ch > '9'){if(ch == '-') f = -1;ch = getchar();}
	while(ch >= '0' && ch <= '9'){ret = ret * 10 + (ch ^ 48);ch = getchar();}
	a = ret * f;
}
inline int Max(int x,int y){return x > y ? x : y;}
inline int Min(int x,int y){return x < y ? x : y;}
inline ll gcd(ll x,ll y){return y ? gcd(y,x % y) : x;}
int main()
{
	int T;ll a,b,c,d,g;
	read(T);
	while(T--)
	{
		read(a),read(b),read(c),read(d);
		if(a < b || b > d) printf("No\n");
		else if(c > b - 2) printf("Yes\n");
		else
		{
			g = gcd(b,d);
			if((a - b) / g >= (a - c - 1) / g) printf("Yes\n");
			else printf("No\n");
		}
	}
	return 0;
}


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

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

    int ara[n];
    for(int i=0;i<n;i++)cin>>ara[i];

    int cnt = 0;
    int ara2[n];

    for(int i=0;i<n;i++)
    {
        if(ara[i]%2 == 0 && ara[i]%3 != 0 && ara[i]%5 != 0)cnt++;
    }
    if(cnt==0)cout<<"APPROVED"<<endl;
    else cout<< "DENIED"<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				sc.close();
				break;
			}
			for (int i=0; i < H; i++) {
				for (int j=0; j < W; j++) {
					System.out.print("#");
					// 1????????即?????????
					if (j == W-1) System.out.println();
				}
				if (i == H-1) System.out.println();
			}
		}
	}
}

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

int main() {
 
  int x;
  cin >> x;

  for(int i = 0; i < 10e100; i++) {
    int t = 0;
    for(int j = 2; j < x; j++) {
      if(x % j == 0) {
        t++;
        break;
      }
    }
    if(t <= 0) {
      break;
    }
    x++;
  }
  cout << x << endl;
    return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int n;

void dfs(string s, int mx){
    if(s.length() == n) cout<<s<<endl;
    else{
        for(int i=0;i<=mx;i++){
            char c = 'a' + i;
            string tmp = s + c;
            sort(tmp.begin(),tmp.end());
            dfs(s+c, tmp[tmp.length()-1] - 'a' + 1);
        }
    }
    return;
}

int main(){
    cin>>n;

    dfs("a",1);
}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
string ss ="ABC";
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    init();
    ll n;
    cin>>n;
    ll mn = 1e18;
    for(ll i=1;i*i<=n;i++){
        ll div = n/i;
        if(i*div==n){
            mn =min(mn,i+div-2);
        }
    }
    cout<<mn;
    return 0;
}

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


int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  int sum = 0;
  for(int i = 0; i < N; i++){
    sum += vec.at(i);
  }
  int a;
  a = (sum - 1) / (4 * M);
  int count = 0;
  for(int i = 0; i < N; i++){
    if(a < vec.at(i)){
      count++;
    }
  }
  if(M <= count){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
const int INF=1001001001;

int main() {
  string S;
  int64_t K;
  cin>>S>>K;
  int N=S.size();
  auto ans= [&](string T){
    int64_t cnt=1,ans=0;
    int n=T.size();
    for(int i=0;i<n;i++){
      if(T[i]==T[i+1]){cnt++;}
      if(i==n-1){ans+=cnt/2;}
      else if(cnt>=2&&T[i]!=T[i+1]){ans+=cnt/2;cnt=1;}
    }
    return ans;
  };

  set<char>k;
  for(int i=0;i<N;i++){
    k.insert(S[i]);
  }
  if(k.size()==1){cout<<N*K/2<<endl;}
  else if(S[0]!=S[N-1]){cout<<ans(S)*K<<endl;}
  else{
    int r=0,l=0;
    for(int i=0;i<N;i++){
      if(S[i]==S[0]){r++;}
      else{break;}
    }
    for(int i=N-1;i>=0;i--){
      if(S[i]==S[N-1]){l++;}
      else{break;}
    }//cout<<ans(S)<<ans(S+S)<<endl;
    int d=ans(S+S)-ans(S);
    cout<<ans(S)+(K-1)*d<<endl;
    //cout<<ans(S)*K-(r/2+l/2-(r+l)/2)*(K-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3612
//Author: master19
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ff first 
#define ss second 
#define pb push_back
#define endl "\n"
#define PI acos(-1.0)
#define mod 1000000007LL // fixed...
#define modd 1000000007LL // Can be changed for global use
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define Yes cout << "Yes\n"
#define No cout << "No\n"
#define all(arr) arr.begin(),arr.end()
#define x(arr) arr.begin(),arr.end()
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define Sort(arr) sort(arr.begin(), arr.end())
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];
#define get_set(arr, num, st, type) set < type > st; for(int i=0; i<num; i++) st.insert(arr[i]);
#define put(arr, num) for(int i=0; i<num; i++)cout << arr[i] << " "; cout << endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > new_ds; 
ll lets_do_it();
pair < ll, ll > xy[] = {{-1, 0}, {1, 0} , {0, -1}, {0, 1}};
pair < ll, ll > dig[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
bool isValid(ll x, ll y, ll row, ll col){
    return ((x>=0) && (y >=0)  && (x < row) && (y < col));
}
int main(int argc, const char** argv) {
    crap;
    ll test = 1;
    // cin >> test;
    for(int loop=0; loop<test; loop++){
        // cout << "Case #" << (loop+1) << ": "; 
        lets_do_it();
    }
    return 0;
}
ll lets_do_it(){
    // Your code goes by here !!
    ll num;
    cin >> num;
    get(arr, num);
    ll count = 0;
    for(int i=0; i<num; i++){
        for(int j=0; j<i; j++){
            for(int k=0; k<j; k++){
                if(arr[i]+arr[j] > arr[k] && arr[i] + arr[k] > arr[j] && arr[j] + arr[k] > arr[i] && arr[i] != arr[j] && arr[j] != arr[k] && arr[i] != arr[k]){
                    count++;
                    // cout << i+1 << "->" << arr[i]<< "|" << j+1 << "->" << arr[j] << "|" << k+1 << "-> " << arr[k] <<endl;
                }
            }
        }
    }
    cout << count << endl;



    return 0;
}


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

class Program {
    internal static void Main(string[] args) {
        var N = ReadLine().ToCharArray();
        if ((N[0] == N[1] && N[1] == N[2]) ||
            N[1] == N[2] && N[2] == N[3]) {
            WriteLine("Yes");
        } else {
            WriteLine("No");
        }
     }
}

Measured memory_bytes: 13140
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {
	
	
	string s,t;
	cin >> s >> t;

	cout << t << s << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        int a,b;
        String op;
        boolean sw=true;
        while(sw){
        a = sc.nextInt();
        op = sc.next();
        b = sc.nextInt();
        
        if(op.equals("+"))System.out.println(a+b);
        if(op.equals("-"))System.out.println(a-b);
        if(op.equals("*"))System.out.println(a*b);
        if(op.equals("/"))System.out.println(a/b);
    	if(op.equals("?"))break;
        }
   }
}


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

int main(){
	int N,M,p;
	cin>>N>>M>>p;
	int d[10001];
	d[0]=p;
	for(int i=1;i<=M;i++){
		cin>>d[i];
	}
	sort(d,d+M+1);
	int c_min=N-1;
	for(int i=0;i<M+1;i++){
		int q=d[i];
		int r1=d[(i-1+M+1)%(M+1)];
		int r2=d[(i+1)%(M+1)];
		int c1=((p-q+N)%N)*2+(r1-p+N)%N;
		int c2=((q-p+N)%N)*2+(p-r2+N)%N;
		c_min=min(c_min,min(c1,c2));
	}
	cout<<c_min*100<<endl;

	return 0;
}

Measured memory_bytes: 3116
/*  CREATED BY
    STREAM_CIPHER
    07-sep-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout<<fixed<<setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;//5*64M bit ->5*8M byte ->40MB size for long long int (64 bit)
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        int s;
        cin>>s;
        int dp[s+9]={0};
        dp[0]=1;
        for(int i=3;i<=s;i++)
        {
        	for(int j=3;j<=i;j++)
        	{
        		dp[i]+=dp[i-j];
        		dp[i]%=mod;
        	}
        }
        cout<<dp[s]<<endl;
}

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

using namespace std;

int main(void)
{
	int r, g, b;
	int val;
	
	cin >> r >> g >> b;
	val = r * 100 + g * 10 + b;
	
	if(val % 4) cout << "NO" << endl;
	else cout << "YES" << endl;
	
	return 0;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
    int n;
    cin>>n;
    int cnt=0;
    for (int i = 1; i <= n; i++)
    {
        if(i%2==1) cnt++;
    }
    printf("%.6f\n",(double)cnt/n);
   
   
    return 0;
}

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

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	ll MOD = 1e9 + 7;
	string s; cin >> s;
	vector<vector<ll>> dp(13, vector<ll>(s.size() + 1, 0));
	dp[0][0] = 1;
	rep(i, s.size())rep(j, 13)
	{
		if (s[i] != '?')
		{
			dp[(10 * j + (s[i] - '0')) % 13][i + 1] += dp[j][i];
			dp[(10 * j + (s[i] - '0')) % 13][i + 1] %= MOD;
		}
		else rep(k, 10)
		{
			dp[(10 * j + k) % 13][i + 1] += dp[j][i];
			dp[(10 * j + k) % 13][i + 1] %= MOD;
		}
	}
	cout << dp[5][s.size()] << endl;
}

Measured memory_bytes: 11392
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

int main() {
int Q; cin >> Q;
VP lr(Q); rep(i, 0, Q) scanf("%d %d", &lr[i].first, &lr[i].second);

// エラトステネスのふるい作成．iが素数ならis_prime[i]=1．作成はO(NloglogN)．素数判定がO(1)でできる．
int MAX = 101010;
vector<int> is_prime(MAX, 1);
is_prime[0] = 0, is_prime[1] = 0;
for (int i = 2; i < MAX; ++i) {
    if (!is_prime[i]) continue;
    for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
}

// 2017like数の篩作成．iが2017LikeならL2017[i] =  1. O(MAX)
VI L2017(MAX, 0);
rep(i, 0, MAX){
    if (!(i%2)) continue; // 偶数．
    if (is_prime[i] && is_prime[(i+1)/2]) L2017[i] = 1;
}

// 2017like数の篩の累積和の作成．2017like数の個数．O(MAX)．
VI L2017accu(MAX+1, 0);
partial_sum(ALL(L2017), L2017accu.begin()+1);

//クエリ
rep(i, 0, Q) {
    printf("%d\n", L2017accu[lr[i].second +1] - L2017accu[lr[i].first]);
}

return 0;
}

// 境界，出力文字列 チェック
// int は ± 2*10⁹.
// map[]は対数時間．unordered_map[]は一定時間．


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
const int sz=2e5+7;
const int mod=1e9+7;
int n,m;
int ans;
int t,len;
int f[sz];
int dp[sz];
int d[sz];
int a[sz],b[sz];
void upd(int &x,int y){
	x=x+y>=mod?x+y-mod:x+y;
}
void add(int x,int sum){
	while(x<=len){
		upd(f[x],sum);
		x+=x&-x;
	}
}
int query(int x){
	int ret=0;
	while(x){
		upd(ret,f[x]);
		x-=x&-x;
	}
	return ret;
}
struct node{
	int x,y;
	const bool operator <(const node& p)const{
		if(x!=p.x) return x<p.x;
		else return y>p.y;
	}
}c[sz];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=m;i++) scanf("%d",&b[i]);
	int now=1;
	b[m+1]=INT_MAX;
	for(int i=1;i<=n;i++){
		if(now==1&&a[i]<=b[now]) continue;
		while(a[i]>=b[now+1]) now++;
		if(now==m) break;
		c[++t]=(node){a[i]-b[now],b[now+1]-a[i]};
		d[++len]=a[i]-b[now],d[++len]=b[now+1]-a[i];
	}
	sort(d+1,d+len+1);
	len=unique(d+1,d+len+1)-d-1;
	for(int i=1;i<=t;i++){
		c[i].x=lower_bound(d+1,d+len+1,c[i].x)-d;
		c[i].y=lower_bound(d+1,d+len+1,c[i].y)-d;
	}
	sort(c+1,c+t+1);
	for(int i=1;i<=t;i++){
		if(c[i].x==c[i-1].x&&c[i].y==c[i-1].y) continue;
		dp[i]=(1+query(c[i].y-1))%mod;
		upd(ans,dp[i]);
		add(c[i].y,dp[i]);
	}
	upd(ans,1);
	printf("%d\n",ans);
}

Measured memory_bytes: 4096
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var n = cin.ReadInt;
            var k = cin.ReadInt;
            var s = cin.ReadLine;
            
            var list = new List<int>();
            var charList = new List<char>();
            var sum = 0;
            var bef = '9';
            list.Add(sum);
            charList.Add(bef);
            foreach (var temps in s) {
                if (temps != bef) {
                    if (bef != '9') list.Add(sum);
                    charList.Add(temps);
                }
                bef = temps;
                if (temps != '9') sum++;
            }
            list.Add(sum);

            var count = 0;
            var l = list.Count();
            for (var i = 0; i < l; i++) {
                var now = charList[i];
                if (now=='9') continue; 
                
                var len = now=='0' ? k*2 : k*2+1;
                var to = Min(i+len,l)-1;

                var temp = list[to] - list[i-1];
                if (temp > count) {
                    count = temp;
                }
            }
            WriteLine(count);
        }

        private double MultipleCeil(double value, double multiple) {return Math.Ceiling(value / multiple) * multiple;}

    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

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

int main()
{
  int n;
  cin>>n;
  vector<pair<int,int>>arr(n);
  for(int i=0;i<n;i++){
      cin>>arr[i].first>>arr[i].second;
  }
  int flag=0;
  for(int i=0;i<n-2;i++){
  		if(arr[i].first==arr[i].second and arr[i+1].first==arr[i+1].second and arr[i+2].first==arr[i+2].second){
      	cout<<"Yes";
        flag=1;
        break;
      }
  }
  if(flag==0)
    cout<<"No";
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#define INF 1145141919
using namespace std;

int r, c, mn;
bool senbei[10][10000];

void judge(int d, bool how[], bool howmn[])
{
	if (d < r){
		how[d] = false;
		judge(d + 1, how, howmn);
		how[d] = true;
		judge(d + 1, how, howmn);
		return;
	}
	int sum = 0;
	for (int j = 0; j < c; j++){
		int f = 0, t = 0;
		for (int i = 0; i < r; i++){
			if (senbei[i][j]^how[i]) t++;
			else f++;
		}
		sum += min(t, f);
	}
	if (mn > sum){
	mn = sum;
		for (int i = 0; i < r; i++){
			howmn[i] = how[i];
		}
	}
}

int main()
{
	while (true){
		cin >> r >> c;
		if (!r&&!c) break;
		for (int i = 0; i < r; i++){
			for (int j = 0; j < c; j++){
				cin >> senbei[i][j];
			}
		}

		//s1
		mn = INF;
		bool how[10], howmn[10];
		judge(0, how, howmn);

		for (int i = 0; i < r; i++){
			if (howmn[i]){
				for (int j = 0; j < c; j++){
					senbei[i][j] = senbei[i][j] ? false : true;
				}
			}
		}

		//s2
		int ans = 0;
		for (int j = 0; j < c; j++){
			int t = 0, f = 0;
			for (int i = 0; i < r; i++){
				if (senbei[i][j]) t++;
				else f++;
			}
			ans += max(t, f);
		}

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

Measured memory_bytes: 1256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    int answer =0;
    int x = 0;
    for(int i=0;i<N;i++){
      if(S.substring(i,i+1).equals("I")){
        x++;
        if(x>answer){
          answer=x;
        }
      }else{
        x--;
      }
    }
    System.out.println(answer);
  }
  

  
}

Measured memory_bytes: 21972