akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int A, B, M;
	cin >> A >> B >> M;
	vi a(A), b(B);
	vi x(M), y(M), c(M);
	rep(i, A)
		cin >> a[i];
	rep(i, B)
		cin >> b[i];
	rep(i, M)
		cin >> x[i] >> y[i] >> c[i];
	int ans1 = InfL;
	int ans2 = InfL;
	int ans = InfL;
	rep(i, A)
		ans1 = min(ans1, a[i]);
	rep(i, B)
		ans2 = min(ans2, b[i]);
	ans = ans1 + ans2;
	rep(i, M) {
		ans = min(ans, a[x[i] - 1] + b[y[i] - 1] - c[i]);
	}

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

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (v.size() == 0) return os;
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    os << v[v.size() - 1];
    return os;
}

void solve() {
    int x;
    cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}

int main() {
    solve();
    char tmp;
    while (cin >> tmp) {
        cin.putback(tmp);
        solve();
    }
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

const int x[4] = {-1, 0, 1, 0}, y[4] = {0, -1, 0, 1};

signed main() {
    int h, w;
    cin >> h >> w;
    V(string) mage(h);
    rep(i, h) cin >> mage[i];

    int rx, ry;
    int dist = 0;
    
    rep(sy, h) {
        rep(sx, w) {
            if(mage[sy][sx] == '#') continue;
            rep(gy, h) {
                rep(gx, w) {
                    if(mage[gy][gx] == '#') continue;
                    V(V(bool)) visited(h, V(bool)(w, false));
                    queue<P> q;
                    vvi dis(h, vi(w, 1e5));
                    dis[sy][sx] = 0;
                    visited[sy][sx] = true;
                    q.push(P(sy, sx));
                    while(!q.empty()) {
                        
                        P now = q.front();
                        int nowy = now.fi, nowx = now.se;
                        q.pop();
                        rep(i, 4) {
                            
                            int ny = nowy + y[i], nx = nowx + x[i];
                            if(ny>=h || ny<0 || nx>=w || nx<0) continue;
                            
                            if(!visited[ny][nx] && mage[ny][nx]=='.') {
                                visited[ny][nx] = true;
                                dis[ny][nx] = dis[nowy][nowx] + 1;
                                //cout << "A"<< endl;
                                q.push(P(ny, nx));
                        
                            }

                        }
                    }
                    if(dis[gy][gx] != 1e5) dist = max(dist, dis[gy][gx]);
                }
            }      

        }
    }
    
    cout << dist << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stdint.h>
#include <vector>

using namespace std;

int32_t main()
{
  uint32_t N;
  cin >> N;

  vector<uint64_t> lines;
  for (uint32_t _ = 0; _ < N; _++) {
    uint64_t line;
    cin >> line;
    lines.push_back(line);
  }

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

  uint64_t width_found = false;
  uint64_t width = 0;
  uint64_t height = 0;

  while (!lines.empty()) {
    uint64_t line = lines.back();
    if (!width_found) {
      if (width == line) {
        width_found = true;
      } else {
        width = line;
      }
    } else {
      if (height == line) {
        break;
      } else {
        height = line;
      }
    }
    lines.pop_back();
  }

  cout << width * height << endl;

  return 0;
}


Measured memory_bytes: 1400
import java.io.*;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		//Scanner scan = new Scanner(System.in);
		InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        String str = br.readLine();
        System.out.println(str.toUpperCase());
	}
}

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

int main(int argc, char* argv[]) {
    int n, ri, diff, min;
    cin >> n >> min >> diff;
    int tmp = diff;
    diff = diff - min;
    if (min > tmp) min = tmp;
    for (int i = 2; i < n; i++){
        cin >> ri;
        if (diff < ri - min) diff = ri - min;
        if (min > ri) min = ri;
    }
    cout << diff << "\n";
    return 0;
}



Measured memory_bytes: 3104
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
data_1 = list(map(int,input().split()))
line_i = list()
for i in range(data_1[0]):
    line_i.append(list(map(int,input().split())))
    new = sum(line_i[i])
    line_i[i].append(new)
line_new = list()   
for k in range(data_1[1]+1):
    sammary =0
    for j in range(data_1[0]):
        sammary += line_i[j][k]
    line_new.append(sammary)
line_i.append(line_new)

for l in range(data_1[0]+1):
    print(" ".join(map(str,line_i[l])))


Measured memory_bytes: 5696
#include<stdio.h>
int main(){
int n,a,b,c,d,e;
while(scanf("%d",&n)!=EOF){e=0;a=0;
while(1){b=0;
while(1){c=0;
while(1){d=0;
while(1){
if(a+b+c+d-n==0)
e++;
if(d==9)break;
d++;
}
if(c==9)break;
c++;
}
if(b==9)break;
b++;
}
if(a==9)break;
a++;
}
printf("%d\n",e);
}
return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
    }
    vector<ll> v(n);
    rep(i,n) {
        v[i] = a[i] - i - 1;
    }
    sort(v.begin(),v.end());
    if(n % 2 != 0) {
        int h = (n - 1) / 2;
        int b = v[h];
        ll ans = 0;
        rep(i,n) {
            ans += abs(a[i] - b - i - 1);
        }
        cout << ans << endl;
        return 0;
    } else {
        int h = n / 2;
        int b1 = v[h];
        ll ans1 = 0;
        rep(i,n) {
            ans1 += abs(a[i] - b1 - i - 1);
        }
        int b2 = v[h-1];
        ll ans2 = 0;
        rep(i,n) {
            ans2 += abs(a[i] - b2 - i - 1);
        }
        cout << min(ans1,ans2) << endl;
        return 0;
    }
}

Measured memory_bytes: 3328
n = int(input())
s = input()

r = len([i for i in range(n) if s[i] == "R"])
g = len([i for i in range(n) if s[i] == "G"])
b = len([i for i in range(n) if s[i] == "B"])

count = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            count += 1

print(r * g * b - count)

Measured memory_bytes: 9196
s=input()
t=input()
u=input()
a=b=c=0
now = 0
while 1:
  if now == 0:
    if a==len(s):
      print('A')
      break
    if s[a] == 'a':
      now = 0
    elif s[a] == 'b':
      now = 1
    else:
      now = 2
    a+=1
  elif now == 1:
    if b==len(t):
      print('B')
      break
    if t[b]=='a':
      now = 0
    elif t[b]== 'b':
      now = 1
    else:
      now = 2
    b+=1
  else:
    if c==len(u):
      print('C')
      break
    if u[c]== 'a':
      now = 0
    elif u[c]== 'b':
      now = 1
    else:
      now = 2
    c+=1


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int n;
long long k[100005];
int main(){
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>k[i];
  }
  long long mon=2,mmon=2;
  for(int i=n-1;i>=0;--i){
    long long a=mon/k[i]*k[i];
    if(a<mon) mon=k[i]+a;
    else mon=a;
    mmon=mmon/k[i]*k[i]+(k[i]-1);
    if(mmon<mon){
      cout<<"-1"<<endl;
      return 0;
    }
  }
  cout<<mon<<" "<<mmon<<endl;
}

Measured memory_bytes: 1024
#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 a;
  cin >> a;
  printf("%d\n", a + a * a + a * a * a);
  return 0;
}

Measured memory_bytes: 3768
import itertools
N, K = map(int, input().split(' '))

A_all = []
for i in range(K):
  d = int(input())
  A = list(map(int, input().split(' ')))
  A_all.append(A)

result = 0 
A_all = list(itertools.chain.from_iterable(A_all))
for i in range(1, N + 1):
  if A_all.count(i) == 0:
    result += 1
      
print(result)
  	

Measured memory_bytes: 9368
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static char tramp;
	static char[][] suit = new char[13][4];
	static int[][] num = new int[13][4];

	public static void main(String[] args) {
		while (true) {
			tramp = sc.next().charAt(0);
			if (tramp == '#') break;
			for (int i = 0; i < 4; ++i) {
				for (int j = 0; j < 13; ++j) {
					String card = sc.next();
					num[j][i] = num(card.charAt(0));
					suit[j][i] = card.charAt(1);
				}
			}
			int parent = 0;
			int[] score = new int[2];
			for (int i = 0; i < 13; ++i) {
				int winner = parent;
				for (int j = 1; j < 4; ++j) {
					int player = (parent + j) % 4;
					if (win(suit[i][winner], num[i][winner], suit[i][player], num[i][player])) {
						winner = player;
					}
				}
				score[winner % 2]++;
				parent = winner;
			}
			System.out.println((score[0] > score[1] ? "NS " : "EW ") + (Math.max(score[0], score[1]) - 6));
		}
	}

	static boolean win(char ps, int pn, char cs, int cn) {
		if (ps == cs) return pn < cn;
		return cs == tramp;
	}

	static int num(char c) {
		if (c == 'T') return 10;
		if (c == 'J') return 11;
		if (c == 'Q') return 12;
		if (c == 'K') return 13;
		if (c == 'A') return 14;
		return c - '0';
	}
}

Measured memory_bytes: 24676
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val n: Int = sc.nextLine.toInt
    val Array(d, x) = sc.nextLine.split(" ").map(_.toInt)
    val participants: List[Int] = List.fill(n)(sc.nextInt)
    println(participants.map(
      day => (0 to d).map(i => i * day + 1).takeWhile(i => i<=d).length
    ).sum + x)
  }

}


Measured memory_bytes: 25660
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <regex>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vpii = vector<pii>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

//seiki
//#include <regex>
/*bubun*/
//regex_search("u32", regex("[0-9]"));      // true
/*kanzen*/
//regex_match("u32", regex("(i|u)\\d+"));   // true

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {

    int N,can=1;
    cin >>N;
    vi A(N);
    FOR(i,0,N-1){
        cin >>A[i];
    }
    if(N==1){
        cout <<1;
    }else{
        if(N%2==0){
            vi aaa(N/2,2);
            FOR(i,0,N-1){
                aaa[A[i]/2]--;
                if(aaa[A[i]/2]<0) can=0;
                if(can==0) break;
            }
            if(can==0) cout <<0;
            if(can==1) {
                unsigned long long nn=1;
                FOR(i,1,N/2){
                    nn=(nn*2)%(unsigned long long)(pow(10,9)+7);
                }
                cout <<nn;
            }
        }
        if(N%2==1){
            vi aaa(N/2+1,2);
            aaa[0]=1;
            FOR(i,0,N-1){
                aaa[A[i]/2]--;
                if(aaa[A[i]/2]<0) can=0;
                if(can==0) break;
            }
            if(can==0) cout <<0;
            if(can==1) {
                unsigned long long nn=1;
                FOR(i,1,N/2){
                    nn=(nn*2)%(unsigned long long)(pow(10,9)+7);
                }
                cout <<nn;
            }
        }
    }

    return 0;
}





Measured memory_bytes: 768
import numpy as np

# 読み込み
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(list(map(str, input().rstrip())))

# 外枠を「.」で囲う準備
li = []
for i in range(H+2):
    li.append(["."]*(W+2))

# 外枠付きSの生成
for i in range(1, H+1):
    li[i][1:-1] = S[i-1]

# カウント用配列の準備
ans = []
for i in range(H+2):
    ans.append([0]*(W+2))
ans = np.array(ans)

# カウント処理
for h in range(1, H+1):
    for w in range(1, W+1):
        if li[h][w]=="#":
            ans[h-1:h+2, w-1:w+2] += 1

# カウント結果から必要な場所だけ切り出す
ans = ans.astype("str")
ans = ans[1:-1, 1:-1]

# 「#」で上書きしながら出力
for h in range(H):
    for w in range(W):
        if S[h][w]=="#":
            ans[h, w] = "#"
    print("".join(ans[h]))

Measured memory_bytes: 12744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  int a=0,w=0,t=0,r=0;
  int n;
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    if(s=="AC")a++;
    else if(s=="WA")w++;
    else if(s=="TLE")t++;
    else r++;
  }
  cout << "AC x "<<a<<endl;
  cout << "WA x "<<w<<endl;
  cout << "TLE x "<<t<<endl;
  cout << "RE x "<<r<<endl;
  
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

int dp[100005];

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);
    
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];

    dp[0] = 0;
    for (int i = 1; i < N; ++i) {
        dp[i] = dp[i-1] + abs(h[i]-h[i-1]);
        for (int j = 2; j <= K && 0 <= i-j; ++j) {
            dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]));
        }
    }

    cout << dp[N-1] << endl;

    return 0;
}


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

int main(){
  int N, M, P[100];
  long T[100];
  cin >> N;
  long t=0;
  for(int i=0; i<N; i++){
    cin >> T[i];
    t+=T[i];
  }
  cin >> M;
  for(int i=0; i<M; i++){
    int p, x;
    cin >> p >> x;
    cout << t-T[p-1]+x << endl;
  }
  return 0;
}

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

int main() {
	int h, w, n;
	cin >> h;
	cin >> w;
	cin >> n;

	int i;
	int total = 0;
	if (h < w) {
		for (i = 1; i <= h; i++) {
			total += w;
			if (total >= n) {
				break;
			}
		}
	}
	else {
		for (i = 1; i <= w; i++) {
			total += h;
			if (total >= n) {
				break;
			}
		}
	}

	cout << i << endl;
}


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

int main() {
  string s;
  cin >> s;
  long ans = 0;
  long n = s.length();

  for (int bit = 0; bit < (1<<n-1); bit++) {
    string save = {s[0]};
    for(int i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        ans += atoll(save.c_str());
        save = {s[i+1]};
      }else {
        save += {s[i+1]};
      }
    }
    ans += atoll(save.c_str());
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import copy

# a = get_int()
def get_int():
    return int(input())

# a = get_string()
def get_string():
    return input()

# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]

# a_list = get_string_list():
def get_string_list():
    return input().split()

# a, b = get_int_multi()
def get_int_multi():  # a, b = get_int_multi()
    return map(int, input().split())

# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))

# print("{} {}".format(a, b))
# for num in range(0, a):
# a_list[idx]
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''

def main():

    ac = 0
    wa = 0
    tle = 0
    re =0


    n = get_int()
    for num in range(n):
        work = get_string()
        if work == "AC":
            ac += 1
        elif work == "WA":
            wa += 1
        elif work == "TLE":
            tle += 1
        elif work == "RE":
            re += 1

    print("AC x {}".format(ac))
    print("WA x {}".format(wa))
    print("TLE x {}".format(tle))
    print("RE x {}".format(re))

if __name__ == '__main__':
    main()




Measured memory_bytes: 9380
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
typedef pair< int, int > ii;
typedef vector< ii > vii;

void solve(){
	char a;
	cin>>a;
	if(0 <= a - 'a' && a - 'a' < 26){
		cout<<'a'<<endl;
	}else{
		cout<<'A'<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}



Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(){
  ll n;
  cin>>n;
  ll ans=0;
  bool f=false;
  ll last=1e12;
  for(ll i=0;i<n;i++){
    ll a,b;
    cin>>a>>b;
    ans+=b;
    if(a>b){
      last=min(last,b);
    }
    if(a!=b) f=true;
  }
  if(last!=1e12) ans-=last;
  cout<<(f?ans:0)<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int n;
    cin >> n;
    if (n % 2 == 1)
        n *= 2;
    cout << n << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


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

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

  deque<int> q;
  rep(i,0,N-1) {
    int a;
    cin >> a;
    q.push_back(a);
  }

  q.push_back(0);
  q.push_front(0);

  int total = 0;
  rep(i,0,N+1) total += abs(q[i] - q[i+1]);
  rep(i,1,N) {
    int ans = total;
    ans -= abs(q[i-1] - q[i]);
    ans -= abs(q[i] - q[i+1]);
    ans += abs(q[i-1] - q[i+1]);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 4024
#include "bits/stdc++.h"
#define lpa(i,a,b) for(int i=a; i<b; ++i)
#define lp(i,n) lpa(i,0,n) //This macro is dangerous. It could result in segfault.
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define EPS 0.000000001
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n+1];
	lp(i,n) cin>>a[i+1];
	int pm=min_element(a+1,a+n+1)-a;
	int up=ceil((pm-1)/(k*1.0-1));
	int down=ceil((n-1-(k-1)*up)/((k-1)*(1.0)));
	cout<<up+down;
}

Measured memory_bytes: 640
/**
 *   Author: Praveen Ojha
 *   Created: 23 March 2019
 *   Time: 22:18:36
**/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long double ld;
typedef pair<int,int> pii;

int inf=1000000000000000000;
int32_t main(){__
	int n,w;
	cin>>n>>w;
	int wei[n],value[n],sumi=0;
	for(int i=0;i<n;i++){
		cin>>wei[i]>>value[i];
		sumi+=value[i];
	}
	//cout<<sumi<<"\n";
	vector <int> dp(sumi+10,inf); // dp[i] is minimum weight with which we can get value i.
	dp[0]=0; // Do get 0 value we do not require any weight.
	for(int items=0;items<n;items++){
		for(int current_val=sumi-value[items];current_val>=0;current_val--){
			dp[current_val+value[items]]=min(dp[current_val+value[items]],dp[current_val]+wei[items]);
		}
	}
	int ans=0;
	for(int i=0;i<=sumi;i++){
		if(dp[i]<=w){
			ans=max(ans,i);
		}
		// cout<<dp[i]<<" ";
	}
	cout<<ans<<"\n";
return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*
3
0 x 9 = 0-9 = 10
4
0 x x 9 
それのかずだけ10ふえる
0と9が1個もない場合
10^2 - 8^2
1個しかない場合
10*10 - 10*9*2 + 9*9みたいな

*/
ll MOD = 1e9+7;
ll modpow(ll a, ll n){
  if(n==1) return a%MOD;
  if(n%2==1) return (a*modpow(a,n-1))%MOD;
  else{
    ll t=modpow(a,n/2)%MOD;
    return (t*t)%MOD;
  }
}

const int MAX = 2000010;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit(){
  fac[0] = fac[1]=1;
  finv[0] = finv[1]=1;
  inv[1] = 1;
  for(int i=2; i<MAX; i++){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD-inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;//逆元の階上
  }
}

ll COM(int n, int k){
  if (n<k)
    return 0;
  if (n<0 || k<0)
    return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

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

  ll N, ans = 0;
  cin >> N;
  
  ans = modpow(10, N);
  ll tmp = modpow(9, N);
  tmp *= 2;
  tmp %= MOD;
  ans -= tmp;
  ans += MOD;
  ans %= MOD;
  tmp = modpow(8, N);
  ans += tmp;
  ans %= MOD;
  cout << ans << endl;
}


Measured memory_bytes: 50520
#include<bits/stdc++.h>
using namespace std;
#define Maxn 10010

struct Edge
{
	int a, b;
}E[Maxn];

struct Vert
{
	int id, out;
}v[Maxn];
int n, c[Maxn], Res, Final[Maxn], Head[Maxn], Edge[Maxn*2], To[Maxn*2], Next[Maxn*2], Cnt, Lux;

queue<int> Q;
inline bool cmp(const Vert &a, const Vert &b) { return a.out<b.out; }
inline void Insert(int u, int vv) { To[Cnt]=vv; Next[Cnt]=Head[u]; Head[u]=Cnt++; }

int main()
{
	scanf("%d", &n);
	for (int i=1; i<n; i++)
	{
		scanf("%d%d", &E[i].a, &E[i].b);
		Insert(E[i].a, E[i].b);
		Insert(E[i].b, E[i].a);
		v[E[i].a].out++, v[E[i].b].out++;
	}
	for (int i=1; i<=n; i++) v[i].id=i;
	for (int i=1; i<=n; i++) scanf("%d", &c[i]);
	sort(c+1, c+n+1);
	Res=0;
	for (int i=1; i<=n; i++) if (v[i].out==1) Q.push(v[i].id);
	while (!Q.empty())
	{
		int p=Q.front(); Q.pop();
		Final[p]=c[++Lux];
		//printf("p = %d %d\n", p, Final[p]);
		for (int i=Head[p]; i; i=Next[i])
		{
			int vv=To[i];
			v[vv].out--;
			if (v[vv].out==1) Q.push(vv); 
		}
	}
	for (int i=1; i<n; i++) Res+=min(Final[E[i].a], Final[E[i].b]);
	printf("%d\n", Res);
	for (int i=1; i<=n; i++) printf("%d ", Final[i]);
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <cstring>
#include <string>
#include <sstream>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()

using namespace std;

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

int n;
const int INF = (int)1e7;
const int N = 100;
const int C = 11;
table cost(N);
vector<vector<bool> > used(11);

int dijkstra(int, int, int);

int main(void){
    rep(i, N) cost[i].resize(N);
    rep(i, C) used[i].resize(N);

    for(int c, m, s, g; cin >> c >> n >> m >> s >> g, n; cout << dijkstra(s, g, c) << endl){
        rep(i, N) fill(ALL(cost[i]), INF);
        rep(i, C) fill(ALL(used[i]), false);

        while(m --){
            int a, b, f; cin >> a >> b >> f;
            
            cost[a - 1][b - 1] = cost[b - 1][a - 1] = f;
        }
    }
    
    return 0;
}

int dijkstra(int s, int g, int c){
    table d(c + 1);
    rep(i, c + 1) d[i].resize(n), fill(ALL(d[i]), INF);
    
    d[c][s - 1] = 0;

    while(1){
        int vn = -1, vc = -1;

        rep(i, c + 1) rep(j, n) if(!used[i][j] && (vc == -1 || d[i][j] < d[vc][vn])) vc = i, vn = j;

        if(vc == -1) break;
        used[vc][vn] = true;

        rep(u, n){
            d[vc][u] = min(d[vc][u], d[vc][vn] + cost[vn][u]);
            if(vc) d[vc - 1][u] = min(d[vc - 1][u], d[vc][vn] + cost[vn][u] / 2);
        }
    }

    int ret = INF;
    rep(i, c) ret = min(ret, d[i][g - 1]);
    return ret;
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, answer = 0; string s; cin >> n >> s;
    for(int i = 2; i < n; i++)
        if(s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C')
            answer++;
    cout << answer;
    return 0;
}

Measured memory_bytes: 256
(defun solve-b ()
    (let* ((n (read))
	   (m (read))
	   (vec (make-array n :element-type 'fixnum :initial-element 0)))
      (dotimes (x m)
	(let ((ai (read))
	      (bi (read)))
	  (incf (elt vec (1- ai)))
	  (incf (elt vec (1- bi)))))
      (loop for x across vec do
	   (format t "~a~%" x))))

(defun main ()
  (solve-b))

(main)

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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

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

    int n, l; cin >> n >> l;
    string s[n]; REPI(i, n) cin >> s[i];
    sort(s, s + n);
    REPI(i, n) cout << s[i];
}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys, bisect, math, itertools
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

s = list(input())
if s[1] == "B":
    print("ARC")
else:
    print("ABC")

Measured memory_bytes: 68368
#include <stdio.h>
#include <vector>
#include<iostream>
#include<queue>
using namespace std;

int main() {

   int freq[26];
   string s;

   for ( int i = 0 ; i < 26 ; ++i)
	    freq[i] = 0;

   cin >> s;
   for ( int i = 0  ; i <s.size() ; ++i)
	     freq[s[i] - 'a']++;

   for ( int i = 0 ; i < 26 ; ++i)
       if ( freq[i] == 0){
    	   cout << (char)  ( i  + 'a');
    	   return 0;
       }
   cout<<"None"<<endl;
  return 0;
}


Measured memory_bytes: 512
import math
from collections import deque
from collections import defaultdict

import bisect


#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

a,b = readInts()
s = readChar()

if str.isdigit(s[:a]) and s[a]=="-" and str.isdigit(s[a+1:]):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3444
#include <stdio.h>
int main(void)
{
int S;
int h,m,s;
scanf("%d", &S);

h=S/3600;
m=(S-h*3600)/60;
s=S-h*3600-m*60;

printf("%d:%d:%d\n",h,m,s);

 return 0;
}

Measured memory_bytes: 592
N = int(input())
a = list(map(int, input().split()))
number = [0 for i in range(100001)]
for i in range(N):
    number[a[i]] += 1
ans = 0
for i in range(1, 100000):
    xans = number[i-1] + number[i] + number[i+1]
    ans = max(ans, xans)

print(ans)


Measured memory_bytes: 14008
#include<bits/stdc++.h>
#define ld long double
#define ll long long
#define st first
#define nd second
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pb push_back
using namespace std;
const int D = 61;
ll basis[D];
void insertVector(ll mask) {
	for(int i=D-1; i>=0; --i) {
		if((mask & (1LL<<i)) == 0) continue;
		if(!basis[i]) {
			basis[i] = mask;
			return;
		}
		mask ^= basis[i];
	}
}
bool check(ll mask) {
	for(int i=D-1; i>=0; --i) {
		if((mask & (1LL<<i))==0) continue;
		if(!basis[i]) {
			return false;
		}
		mask ^= basis[i];
	}
	return true;
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t;
	cin>>t;
	while(t--) {
		int n;
		cin>>n;
		vector<ll> a(n);
		for(int i=0; i<n; ++i) {
			cin>>a[i];
		}
		string s;
		cin>>s;
		bool win = 1;
		for(int i=n-1; i>=0; --i) {
			if(s[i]=='0') {
				insertVector(a[i]);
			}
			else if(!check(a[i])){
				win = 0;
				break;
			}
		}	
		if(win) cout<<0<<'\n';
		else cout<<1<<'\n';
		for(int i=0; i<D; ++i) {
			basis[i] = 0;
		}
	}
}


Measured memory_bytes: 3624
#define _USE_MATH_DEFINES  // M_PI等のフラグ

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>

#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

string replace_with_str(string str, string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(int argc, char const *argv[]){
    long N, H, W;
    cin >> N >> H >> W;

    int ans = 0;
    for(int i=0; i<N; i++){
        int A, B;
        cin >> A >> B;
        
        if(A < H || B < W){
            continue;
        }

        ans ++;
    }

    cout << ans << endl;


    return 0;
}

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

num_set = {i for i in range(1, 14)}
S, H, C, D = set(), set(), set(), set()

for i in range(n):
    mark, num = input().split()
    num = int(num)
    if mark == "S":
        S.add(num)
    elif mark == "H":
        H.add(num)
    elif mark == "C":
        C.add(num)
    elif mark == "D":
        D.add(num)

S_dash, H_dash, C_dash, D_dash = list(
    num_set - S), list(num_set - H), list(num_set - C), list(num_set - D)
S_dash.sort()
H_dash.sort()
C_dash.sort()
D_dash.sort()

for i in S_dash:
    print("S", i)

for i in H_dash:
    print("H", i)

for i in C_dash:
    print("C", i)

for i in D_dash:
    print("D", i)



Measured memory_bytes: 5612
#include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int af,bf,cf;
    af = 2*a - b - c;
    bf = 2*b - c - a;
    cf = 2*c - a - b;
    if(af<0) af = -af; 
    if(bf<0) bf = -bf; 
    if(cf<0) cf = -cf; 
    if((a|b|c)&1){
        cout << 0 << endl;
        return 0;
    }
    if (af==0 && bf==0 && cf==0){
        cout << -1 << endl;
        return 0;
    }
    int count = 0;
    while((~(af|bf|cf))&1){
        count++;
        af = af>>1;
        bf = bf>>1;
        cf = cf>>1;
    }
    cout << count << endl;

    return 0;

}


Measured memory_bytes: 256
n, m = map(int, input().split())
d = {i:[] for i in range(1, n)}
for i in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
ans = "IMPOSSIBLE"
for dd in d[1]:
    if n in d[dd]:
        ans = "POSSIBLE"
        break
print(ans)

Measured memory_bytes: 46144
#include <stdio.h>

int
main(void)
{
	int i, n;
	int a = 1, b = 1, c = 2;

	scanf("%d", &n);
	for (i = 1; i < n; i++)
		c = a + b, a = b, b = c;
	printf("%d\n", b);

	return 0;
}



Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n;

void yes(){
   cout<<"Yes"<<endl;
   exit (0);
}
void no(){
   cout<<"No"<<endl;
   exit (0);   
}

int32_t main(){_

   cin>>n;
   vector<int> a(n);

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

   --a[0];   
   for (int i = 1; i < n; ++i)
   {
      a[i] = min(a[i], max(a[i-1], a[i] - 1));
   }  

   bool good = is_sorted(a.begin(), a.end());
   if (good){
      yes();
   }
   else{
      no();
   }

   return 0;
}

/*
   Test on which it fails is :-
   4
   [2 1 1 1] 
*/

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long t;
    string s;
    cin >> t;
    cout << (t / 500) * 1000 + ((t - 500 * (t / 500)) / 5) * 5 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll             long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     pb              emplace_back
#define     pf              emplace_front
#define     all(p)          p.begin(), p.end()
#define     rep(i,a,b)      for( i=a;i<b;++i)
#define     repr(i,a,b)     for( i=a;i>=b;i--)
#define     up              upper_bound
#define     lb              lower_bound
#define     t()             int test;cin>>test;while(test--)
#define     setbits(x)      __builtin_popcountll(x)
#define     si              set<int>
#define     mii             map<int,int>
#define     vi              vector<int>
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     que_min         priority_queue <int, vi, greater<int> >
#define     vii             vector<ii>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


int32_t main()
 
{  
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output 3.txt", "w", stdout);
    #endif

    IOS;
    string s,t;
    cin>>s>>t;
    int sz=s.size();
    int i,f=0;
    rep(i,0,sz)
    {
      if(s[i]!=t[i])
      {
        f=1;
        break;
      }
    }
    if(f)
    {
      cout<<"No"<<endl;
    }
    else
    {
      if((int)t.size()==(int)s.size()+1)
      {
        cout<<"Yes"<<endl;
      }
      else
      {
        cout<<"No"<<endl;
      }
    }
    
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#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>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

void solve()
{
	int n;
	cin>>n;
	vector<string> s(n);
	rep(i, n) cin >> s[i];
	vector<pair<int, int>> p(n);
	rep(i,n){
		int cnt = 0;
		rep(j, s[i].size())
		{
			if(s[i][j]=='('){
				++cnt;
			}
			else{
				--cnt;
			}
			chmin(p[i].first, cnt);
		}
		p[i].second = cnt;
	}
	vector<pair<int, int>> pos, neg;
	rep(i, n)
	{
		if(p[i].second>=0){
			pos.pb(p[i]);
		}
		else{
			neg.pb(p[i]);
		}
	}
	rep(i,neg.size()){
		neg[i] = {neg[i].first - neg[i].second, -neg[i].second};
	}
	sort(rall(pos));
	sort(rall(neg));
	bool ng = false;
	int l = 0;
	rep(i,pos.size()){
		if(l+pos[i].first<0){
			ng = true;
		}
		else{
			l += pos[i].second;
		}
	}
	int r = 0;
	rep(i, neg.size())
	{
		if(r+neg[i].first<0){
			ng = true;
		}
		else{
			r += neg[i].second;
		}
	}
	if(l!=r)
		ng = true;
	if(ng){
		cout << "No";
	}
	else{
		cout << "Yes";
	}
}

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

Measured memory_bytes: 50364
#include <stdio.h>
main(){
  int i,j,n[1001],m[1001],c,a,N,M;
  while(1){
    c=0;
    a=1;
    scanf("%d%d",&N,&M);
    if(N==0 && M==0) break;
    for(i=1;i<=N;i++){
      scanf("%d",&n[i]);
    }
    for(i=1;i<=M;i++){
      scanf("%d",&m[i]);
    }

    while(a<N){
      c++;
      a+=m[c];
      a+=n[a];
    }
    
    printf("%d\n",c);

  }
  return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int max1=-1,f=0;
    while(n--)
    {
        int a;
        cin>>a;
        if(max1-a>=2)
            f=1;
        max1=max(max1,a);
    }
    if(f)
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
# pragma GCC optimize("O3")
# include <bits/stdc++.h>
# define maxn 100005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define sz(x) (int)((x).size())
# define int ll
using namespace std;

int x;

int32_t main(){_
    //freopen("input","r",stdin);
	int l = -1e9;
	int r = 1e9;
	cin >> x;
	l = max(l,x);
	cin >> x;
	r = min(r,x);
	cin >> x;
	l = max(l,x);
	cin >> x;
	r = min(r,x);
	rc(max(0LL,r - l));
}


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 = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            int ans = 0;
        
            for(int i=a; i <= b; i++){
                if(c % i == 0)
                    ans++;
                }
            System.out.println(ans);
            }
    }



Measured memory_bytes: 26332
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
    } 
    int cnt = 1;
    int light_button = a[0];
    bool flag = 1;
    while(cnt <= n){
        if(light_button == 2){
            cout << cnt << endl;
            flag = 0;
            break;
        }
        cnt++;
        light_button = a[light_button-1];
    }

    if(flag){
        cout << -1 << endl;
    }

}




Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>

using namespace std;

void solve()
{
	int H, W;
	while (cin >> H >> W, H || W)
	{
		for (int i = 0; i < W; ++i)
		{
			cout << "#";
		}
		cout << endl;
		for (int i = 1; i < H - 1; ++i)
		{
			cout << "#";
			for (int j = 1; j < W - 1; ++j)
			{
				cout << ".";
			}
			cout << "#" << endl;
		}
		for (int i = 0; i < W; ++i)
		{
			cout << "#";
		}
		cout << endl;
		cout << endl;
	}
}

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

Measured memory_bytes: 1156
#include<bits/stdc++.h>
 
#define ll long long 
#define skorost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 

using namespace std ;
 
int z , o ,ans ;

ll N = 1e9 + 7 ;

int code(  ){

	int a , b ;

	cin >> a >> b ;

	cout << a * b << endl ;

	return 0 ;

}

int main(){ skorost ;

	int t ;

	t = 1 ;

	while( t -- ){

		code( ) ;

	}

}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;


int main(){

    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ',') cout << " ";
        else cout << s[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3632