akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef vector<char> vc;
typedef vector<vector<char> > vvc;
typedef vector<double> vd;
typedef vector<vector<double> > vvd;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;
typedef deque<bool> db;
typedef deque<deque<bool> > ddb;

// cout pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    s << p.first << " " << p.second << "\n"; return s;
}

// cout vector<pair>
template<typename T1, typename T2> ostream& operator<<(ostream& s, const vector<pair<T1, T2> >& vp) {
    int len = vp.size(); s << "\n";
    for (int i = 0; i < len; ++i) { s << vp[i]; }
    s << "\n"; return s;
}

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size(); s << "\n";
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    s << "\n"; return s;
}

// cout deque
template<typename T> ostream& operator<<(ostream& s, const deque<T>& v) {
    int len = v.size(); s << "\n";
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) { s << vv[i]; }
    return s;
}

// cout 2-dimentional deque
template<typename T> ostream& operator<<(ostream& s, const deque< deque<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) { s << vv[i]; }
    return s;
}

int main() {
    int a, b, h;
    cin >> a;
    cin >> b;
    cin >> h;
    printf("%d\n", (a + b) * h / 2);
    return 0;
}


Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,m;cin>>n>>m;
  ll in=-1000000000000000;
  ll a[m],b[m],c[m];
  vector<pair<ll,ll>>list[n+1];
  for(ll i=0;i<m;i++){
    cin>>a[i]>>b[i]>>c[i];
    list[a[i]].push_back(make_pair(b[i],c[i]));
    
  }
  ll score[n+1];
  //cout<<list[1][1].first<<list[1][1].second<<endl;return 0;
  for(ll i=0;i<=n;i++)score[i]=in;
  score[1]=0;
  for(ll i=0;i<2*n;i++){
    for(ll j=1;j<=n;j++){
      bool update=false;
      if(score[j]!=in){
        for(ll k=0;k<list[j].size();k++){
          ll f=list[j][k].first;
          ll s=list[j][k].second;
          if(score[f]<score[j]+s){
            score[f]=score[j]+s;
            if(f==n)update=true;
          }
        }
      }
      if(i>=n-1&&update){
        cout<<"inf"<<endl;
        return 0;
      }
    }
  }
  cout<<score[n]<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;cin>>s;
    bool ans=true;
    for(int i=0;i<s.length();i++){
        if(i%2==0&&s[i]=='L'){
            ans=false;
        }
        if(i%2==1&&s[i]=='R'){
            ans=false;
        }
    }
    if(ans==false){cout<<"No"<<endl;}
    else{cout<<"Yes"<<endl;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using vpsi=vector<pair<string,int>>;
using vi=vector<int>;

int main() {
  int n,a; string s;
  cin>>n;
  vpsi sp(n), sp_(n);
  for(int i=0; i<n; i++){
    cin>>sp.at(i).first>>sp.at(i).second;
    s=sp.at(i).first; a=sp.at(i).second;
    sp_.at(i)=make_pair(s,-a);
  }
  sort(sp_.begin(),sp_.end());
  for(int i=0; i<n; i++){
    s=sp_.at(i).first; a=sp_.at(i).second;
    sp_.at(i)=make_pair(s,-a);
  }
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(sp_.at(i).first==sp.at(j).first&&sp_.at(i).second==sp.at(j).second){
        cout<<j+1<<endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    vector<vector<int>> graph(n);
    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    vector<int> p1 = {0}, p2 = {0};
    vector<bool> used(n, false);
    used[0] = true;
    while (true) {
        int node = p1.back();
        int next = -1;
        for (int to: graph[node]) {
            if (!used[to]) {
                next = to;
                break;
            }
        }
        if (next != -1) {
            p1.push_back(next);
            used[next] = true;
        } else {
            break;
        }
    }
    while (true) {
        int node = p2.back();
        int next = -1;
        for (int to: graph[node]) {
            if (!used[to]) {
                next = to;
                break;
            }
        }
        if (next != -1) {
            p2.push_back(next);
            used[next] = true;
        } else {
            break;
        }
    }
    vector<int> fans = p1;
    reverse(fans.begin(), fans.end());
    fans.insert(fans.end(), p2.begin() + 1, p2.end());
    cout << SZ(fans) << '\n';
    for (int node: fans) {
        cout << node + 1 << ' ';
    }
    cout << '\n';
}


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

int main(){
    int n;  cin >> n;
    vector<ll> l(n);
    for(int i=0; i<n; i++)  cin >> l.at(i);
    sort(l.begin(), l.end());
    int cnt=0;
    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            int ab = l.at(i)+l.at(j);
            auto c = lower_bound(l.begin(), l.end(), ab) - l.begin();
            cnt += c-j-1;

        }
    }
    cout << cnt << endl; 
}

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

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORTASC(c) sort((c).begin(), (c).end())
#define SORTDESC(c, t) sort((c).begin(), (c).end(), std::greater<t>());
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

const double PI = acos(-1.0);

using ll = long long;
using namespace std;

int main()
{
    ll n;
    unordered_map<string, ll> mp;
    set<string> st;

    cin >> n;

    string s;
    REP(i, n){
        cin >> s;
        st.insert(s);
        mp[s]++;
    }

    ll mx = 0;
    for(auto k:st){
        mx = max(mx, mp[k]);
    }

    for(auto k:st){
        if(mp[k] == mx){
            cout << k << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 33480
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  a %= 7;
  if(a == 1) cout << "fri" << endl;
  if(a == 2) cout << "sat" << endl;
  if(a == 3) cout << "sun" << endl;
  if(a == 4) cout << "mon" << endl;
  if(a == 5) cout << "tue" << endl;
  if(a == 6) cout << "wed" << endl;
  if(a == 0) cout << "thu" << endl;
  return (0);
}



Measured memory_bytes: 3112
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD;
	auto B = RD;

	long cnt = 1, ans;
	while (cnt < B)
	{
		cnt += A - 1;
		++ans;
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b

# https://atcoder.jp/contests/abc115/tasks/abc115_a


print(['Christmas', 'Christmas Eve', 'Christmas Eve Eve',
       'Christmas Eve Eve Eve'][[25, 24, 23, 22].index(a_int())])


Measured memory_bytes: 68604
S=input()
if S == "keyence":
  print("YES")
else:

  flag=0
  for i in range(len(S)):
      for j in range(i+1,len(S)):
          if S[0:i]+S[j:] == 'keyence':
              flag=1
  if flag==1:
      print("YES")
  else:
      print("NO")

Measured memory_bytes: 3060
def f(n):
    if n%2==0:
        return n/2
    else:
        return 3*n+1

from collections import defaultdict
d = defaultdict(lambda: 0)
a = int(input())
d[a] = 1
for i in range(10**6):
    a = f(a)
    if d[a] != 0:
        print(i+2)
        break
    else:
        d[a] = 1

Measured memory_bytes: 3316
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#define R(i, n) for(int i = 0;i < n;i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define P(a) printf("%d", a)
#define INF 1000000000
using namespace std;
using ll = long long;
using IR = pair<int, int>;

int N, M, A[100];

int main() {
	S2(N, M);
	int sum = 0;
	R(i, N) {
		scanf("%d", A + i);
		sum += A[i];
	}
	int pop = 0;
	R(i, N) {
		if ((double)A[i] >= (double)sum / (4 * M)) pop++;
		if (pop == M) {
			printf("Yes");
			return 0;
		}
	}
	printf("No");
}

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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);


void go(){
	int x;cin>>x;
	if(x==7||x==5||x==3) cout << "YES";
	else cout << "NO";
} 
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+50;
ll n,k;
ll a[maxn];
inline int log_number(int x,int mid)
{
    if(x%mid==0) return x/mid;
    else return x/mid+1;
}
bool check(int x)
{
    int ans=0;
    for(int i=1;i<=n;++i)
    {
        ans+=log_number(a[i],x)-1;
    }
    if(ans<=k) return true;
    else return false;
}
int main()
{
    cin>>n>>k; 
    for(int i=1;i<=n;++i) cin>>a[i];
    int l=1,r=1e9;
    int ans=0;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(check(mid)) r=mid-1,ans=mid;
        else l=mid+1; 
    }
    /*if(check(l))  cout<<l<<endl;
    else cout<<r<<endl;*/
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5176
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main() {
  int a[3];
  for (int i = 0; i < 3; i++) {
    scanf("%d",&a[i]);
  }
  qsort(a,3,sizeof(int),compare_int);
  printf("%d\n",10*a[2]+a[1]+a[0]);
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;
#define PI = 3.14159265358979323846
/*------------------------------------------------------------------------------*/

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

  ll ans = 0;
  ll rem;

  ans = (x / 11) * 2;
  rem = x % 11;
  if(rem > 0){
    ans++;
    if(rem > 6){
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double r;
    cin>>r;
    double PI = 3.1415926535897932384626;
    cout<<setprecision(20)<<2.0*r*PI<<endl;
}


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

int main(){
	
	int n;
	cin>>n;
	int F[n];
	F[0]=F[1]=1;
	for(int i=2;i<=n;i++)
		F[i]=F[i-1]+F[i-2];
		
	cout<<F[n]<<endl;
	
	return 0;
}


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

  int DS (int N) {
   int sum = 0;
   while (N > 0) {
    sum += N % 10;
    N /= 10;
   }
    return sum;
  }

int main() {
  int N; 
  cin >> N;
  int sum = DS(N);

  if (N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    char a[4];
    cin >> a ;
    if(a[0]==a[2]){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

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

using namespace std;

int main()
{
	int n,m;
  cin >> n >> m;
  
  for(int i=0;i<m;i++)
  {
    int x;
    cin >> x;
    n -= x;
  }
  
  if(n < 0)
    n = -1;
  
  cout << n << endl;
}

Measured memory_bytes: 3636
import sys
n, k = map(int, input().split())
a = list(map(int, input().split()))
if n == 1:
	if k%2 == 1:
		print(a[0])
	else:
		print("")
else:
	aa = a + a
	skip = [0 for _ in range(n)]
	ind = dict()
	for i in range(2*n-1, -1, -1):
		if aa[i] in ind and i < n:
			skip[i] = ind[aa[i]]-i+1
		ind[aa[i]] = i
	#print(skip)
	if k == 1:
		ans = []
		cnt = 0
		while cnt < n:
			if cnt + skip[cnt%n] > n:
				ans.append(a[cnt])
				cnt += 1
			elif cnt + skip[cnt%n] <= n:
				cnt += skip[cnt%n]
		print(*ans)
		sys.exit()
	cnt = 0
	while cnt == 0 or (cnt + skip[cnt%n] <= n*k and cnt%n != 0):
		cnt += skip[cnt%n]
	if cnt%n == 0:
		l = cnt//n
		#print(l)
		k %= l
		if k == 0:
			print("")
			sys.exit()
		cnt = 0
		while cnt == 0 or cnt + skip[cnt%n] <= n*k:
			cnt += skip[cnt%n]
	ans = []
	cnt = cnt%n
	while cnt < n:
		if cnt + skip[cnt%n] > n:
			ans.append(a[cnt])
			cnt += 1
		elif cnt + skip[cnt%n] <= n:
			cnt += skip[cnt%n]
	print(*ans)

Measured memory_bytes: 119216
while True:
    try:
        a=input()
    except EOFError:
        break
    b=0
    c=0
    for i in range(len(a)):
        if a[i:i+3]=='JOI':
            b+=1
        elif a[i:i+3]=='IOI':
            c+=1
        else:
            pass
    print(b)
    print(c)


Measured memory_bytes: 5572
#include <stdio.h>

int main(void) {
	int h,w,i,j,k,t[128];
	char s[128];
	scanf("%d%d",&h,&w);
	for(i = 1;i <= h;i++){
		scanf("%s",s);
		for(j = 0;j <= 127;j++){t[j] = -1;}
		for(j = 0;j < w;j++){
			if(s[j] == 'c'){
				for(k = 0;j + k < w;k++){
					if(t[j + k] == -1 || k < t[j + k]){t[j + k] = k;}
				}
			}
		}
		for(j = 0;j < w;j++){
			printf("%d",t[j]);
			if(j != w - 1){printf(" ");}
		}
		printf("\n");
	}
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int count = 1;

        int n = int.Parse(Console.ReadLine());
        int k = int.Parse(Console.ReadLine());

        for(int i = 0; i<n; i++)
        {
            int x2 = count * 2;
            int pk = count + k;
            if (x2 < pk)
            {
                count = x2;
            }else
            {
                count = pk;
            }
        }

        Console.WriteLine(count.ToString());
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int a;
    cin >> a;
    print(a+a*a+a*a*a);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3 + 7;
const double pi = acos(-1);
const int mod = 998244353;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int f = 0;
	while(a && c){
		c -= b;
		if(c <= 0){
			f = 2;
			break;
		}
		a -= d;
		if(a <= 0){
			f = 1;
			break;
		}
	}
	if(f == 2) cout << "Yes\n";
	else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3596
import math
def trial_division(n):
    a = [1]
    for i in range(2,int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a

A, B = map(int, input().split())
print(len(set(trial_division(A))&set(trial_division(B))))

Measured memory_bytes: 38512
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
typedef long long int ll;

int main() {
  ios::sync_with_stdio(false);

  ll n;
  cin >> n;
  if(n%2!=0) n*=2;
  cout << n << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int cnt[100010];
int cnt2[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int X[100010];
    rep(i, N) cin >> X[i];
    rep(i, N) {
        cnt[X[i] % M]++;
        cnt2[X[i]]++;
    }
    // rep(i, M) cout << cnt[i] << " ";
    // cout << endl;
    int ans = 0;
    rep(i, M) {
        int a = i, b = (M - i) % M;
        int tmp = min(cnt[a], cnt[b]);
        if(a == b) tmp /= 2;
        ans += tmp;
        cnt[a] -= tmp;
        cnt[b] -= tmp;
    }
    // rep(i, M) cout << cnt[i] << " ";
    // cout << endl;
    rep(i, 100001) {
        if(cnt[i % M] > 1) {
            //cout << i << " " << cnt2[i] << endl;
            int tmp = min(cnt[i % M], cnt2[i]) / 2;
            ans += tmp;
            cnt[i % M] -= tmp * 2;
        }
    }
    cout << ans << endl;

    return 0;
}


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

#define PB push_back
#define MP make_pair
#define LL long long
#define LLU usinged long long
#define SZ(a) ((int)a.size())


using namespace std;

int main() {
	
	int N,M;
	scanf("%d %d", &N, &M);
	
	map<int,LL> minC;
	
	minC[0] = 0;
	
	for(int i = 0; i < M; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		
		int mask = 0;
		
		for(int j = 0; j < b; j++) {
			int c;
			scanf("%d", &c);
			mask = mask | (1 << (c-1));
		}
		
		for(auto it : minC) {
			int mm = mask | it.first;
			LL cost = a + it.second;
			if(minC.find(mm) == minC.end())
				minC[mm] = cost;
			else
				minC[mm] = min(minC[mm], cost);
		}
	}
	
	int mask = (1 << N)-1;
	
	if(minC.find(mask) == minC.end()) printf("-1\n");
	else printf("%lld\n", minC[mask]);
	
	return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    int ans = 0;
    int a;
    for(int i = 0;i < n;i++){
        cin >> a;
        ans += min(a, k-a);
    }

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

Measured memory_bytes: 256
N,M = [int(i) for i in input().split()]
Nodes = []
Mlist = []
count = 0
for i in range(N):
    Mlist.append(1)
for i in range(M):
    Nodes.append(list(map(int, input().split())))


def search(x):
    Mlist2[x-1] = 0
    for i in range(len(Nodes2)):
        if x in Nodes2[i]:
            if Nodes2[i].index(x) == 0:
                if Mlist2[Nodes2[i][1]-1] != 0:
                    search(Nodes2[i][1])
                else: continue
            if Nodes2[i].index(x) == 1:
                if Mlist2[Nodes2[i][0]-1] != 0:
                    search(Nodes2[i][0])
                else: continue
        else: continue
    #print(Mlist2)
    return(Mlist2)

def cout(x):
    answer = 1
    for i in range(len(x)):
        if x[i] == 0:
            continue
        else:
            answer = 0
            break
    if answer == 1:
        return 1
    if answer == 0:
        return 0

for i in range(M):
    #print (i)
    Nodes2 = Nodes[:]
    Mlist2 = Mlist[:]
    del Nodes2[i]
    ans = cout(search(1))
    if ans == 0:
        count += 1
print(count)



Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <time.h>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;


vector<int> g[100];
int in[100];
vector<int> res;
int done[100];
int dfs(int x){
	if( done[x]++ ) return 0;
	for(int i = 0 ; i < g[x].size() ; i++) dfs(g[x][i]);
	res.push_back(x);
}
int main(){
	int m,n;
	cin >> m >> n;
	
	for(int i = 0 ; i < n ; i++){
		int a,b;
		cin >> a >> b;
		a--,b--;
		g[a].push_back(b);
		in[b]++;
	}
	for(int i = 0 ; i < m ; i++){
		dfs(i);
	}
	reverse(res.begin(),res.end());
	for(int i = 0 ; i < m ; i++){
		cout << res[i]+1 << endl;	
	}
	
}

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

int main() {
	int N;
	cin >> N;
	vector<long long> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	long long Min = 1e10;
	long long Max = 0;
	for (int i = 0; i < N; i++) {
		Min = min(A[i], Min);
		Max = max(A[i], Max);
	}

	cout << Max - Min << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string w = Console.ReadLine();
            //ハッシュセットに入れ種類を判断
            HashSet<string> hashStr = new HashSet<string>();
            string result = "Yes";
            for(int i = 0; i < w.Length; i++)
            {
                //1文字ずつ入れ込む
                hashStr.Add(w.Substring(i, 1));
            }
            List<string> hash = new List<string>();
            hash = hashStr.ToList();
            //出現回数
            for(int j = 0; j < hash.Count(); j++)
            {
                int cnt = 0;
                for (int z = 0; z < w.Length; z++)
                {
                    if (w.Substring(z, 1) == hash[j])
                    {
                        cnt++;
                    }
                }
                if (cnt % 2 != 0)
                {
                    result = "No";
                    break;
                }
            }
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);


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

// one-based numbering
struct UnionFind {
    vector<int> data;
    // i: (data[i] < 0) -> group size, (data[i] > 0) -> parent;
    UnionFind(int n) {
        data.resize(n+1, -1);
    }
    int find(int x) {
        if(data[x] < 0) return x;
        else return data[x] = find(data[x]);
    }
    int size(int x) {
        return -data[find(x)];
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    bool same(int x, int y) {
        x = find(x); y = find(y);
        return x == y;
    }
};

int m[110][110];
int d[110][110];

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h, w; cin >> h >> w;
    UnionFind uf(h*w);
    auto e = [&](int a, int b) { return a * w + b + 1; };
    auto in = [&](int a, int b) {
        return 0 <= a && a < h && 0 <= b && b < w;
    };
    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        for (int j = 0; j < w; j++) {
            if (s[j] == '#') m[i][j]++;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            d[i][j] = 1e9;
            for (int t = 0; t < 2; t++) {
                int x = i + dx[t], y = j + dy[t];
                if (!in(x, y)) continue;
                if (m[i][j] == m[x][y]) {
                    uf.unite(e(i, j), e(x, y));
                }
            }
        }
    }
    d[0][0] = 0;
    deque<int> qx, qy;
    qx.emplace_front(0), qy.emplace_front(0);
    while (!qx.empty()) {
        int x = qx.front(), y = qy.front();
        qx.pop_front(), qy.pop_front();
        int curr = d[x][y];
        for (int t = 0; t < 2; t++) {
            int i = x + dx[t], j = y + dy[t];
            if (!in(i, j)) continue;
            if (m[i][j] != m[x][y]) {
                if (d[i][j] > curr + 1) {
                    d[i][j] = curr + 1;
                    qx.emplace_back(i), qy.emplace_back(j);
                }
            } else {
                if (d[i][j] > curr) {
                    d[i][j] = curr;
                    qx.emplace_front(i), qy.emplace_front(j);
                }
            }
            
        }
    }
    if (!m[0][0]) cout << (d[h-1][w-1] + 1) / 2 << "\n";
    else cout << (d[h-1][w-1] + 2) / 2 << "\n";
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n,ans = 0;
  string s,ss,sss;
  double aa;cin>>aa;
  printf("%.10f\n",2*aa*acos(-1));
  return 0;
}


Measured memory_bytes: 3840
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define MAX 100005
#define mod 998244353
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) printf("Case %lld:\n",i)
#define pf(a) printf("%lld ",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp,mp1;
vector<pair<ll,pair<ll,pair<ll,ll> > > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v,v1,v2,dummy;
map<pair<ll,ll>,ll>mpp;
map<ll,bool>mb;
ll n,x,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
ll ans=0;
ll dp[MAX+10];
ll arr[MAX+10];
ll calc(ll pos)
{
    ll ret=0,ret1=0;
    if(pos>=n)return 0;
    else if(dp[pos]!=-1) return dp[pos];
    if(pos+2<=n)
    {
        ret=min(ret+calc(pos+1)+abs(arr[pos+1]-arr[pos]),ret+calc(pos+2)+abs(arr[pos+2]-arr[pos]));
    }
    else ret=ret+calc(pos+1)+abs(arr[pos+1]-arr[pos]);
    return dp[pos]=ret;
}
int main()
{
    cin>>n;
    v.clear();
    memset(arr,0,sizeof arr);
    FOR1(i,n)
    {
        cin>>arr[i];
    }
    memset(dp,-1,sizeof dp);
    ans=calc(1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
#include"bits/stdc++.h"
using namespace std;

int main() {
    long long K;
    cin >> K;

    long long N = 50;
    vector<long long> a(N), b(N);
    for (int i = 0; i < N; i++) {
        if (i < K % N) {
            b[i] = K / N + 1;
        } else {
            b[i] = K / N;
        }
    }

    for (int i = 0; i < N; i++) {
        a[i] = 51 * b[i] - K + 49;
    }

    cout << N << endl;
    for (int i = 0; i < N; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<P> v;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    v.push_back(P(b, a));
  }
  sort(v.begin(), v.end());
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    sum += v[i].second;
    if (sum > v[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    rep(i, n){
        if(a[i] == b[i] && b[i] == c[i]) continue;
        else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) ans += 1;
        else ans += 2;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <limits>

using namespace std;

int main(int argc, char *argv[]) {
	int N;

	cin >> N;

	vector<int> mid(N);
	priority_queue<int, vector<int>, greater<int>> pos;
	priority_queue<int, vector<int>, greater<int>> neg;

	vector<long> pos_sum(N+1);
	vector<long> neg_sum(N+1);
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		pos.push(x);
		pos_sum[0] += x;
	}
	for (int i = 0; i < N; i++) {
		cin >> mid[i];
	}
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		neg.push(-x);
		neg_sum[N] -= x;
	}

	for (int i = 1; i <= N; i++) {
		pos.push(mid[i-1]);
		int x = pos.top();
		pos.pop();
		pos_sum[i] = pos_sum[i-1] + mid[i-1] - x;
	}

	for (int i = N - 1; i >= 0; i--) {
		neg.push(-mid[i]);
		int x = neg.top();
		neg.pop();
		neg_sum[i] = neg_sum[i+1] - mid[i] - x;
	}

	long ans = numeric_limits<long>::min();
	for (int i = 0; i <= N; i++) {
		ans = max(ans, pos_sum[i] + neg_sum[i]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3320
#include<stdio.h>

int main(void){
	int month,day;
	int md[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int i,past;

	while(1){
		past=0;
	scanf("%d %d", &month, &day);
	if(month==0) break;
	for(i=0;i<=month-2;i++) past+=md[i];
	past+=day-1;
	switch(past%=7){
		case 0: printf("Thursday\n"); break;
		case 1: printf("Friday\n"); break;
		case 2: printf("Saturday\n"); break;
		case 3: printf("Sunday\n"); break;
		case 4: printf("Monday\n"); break;
		case 5: printf("Tuesday\n"); break;
		case 6: printf("Wednesday\n"); break;
	};
	};
	return (0);
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

namespace mymod {ll add(ll a, ll b);ll sub(ll a, ll b);ll mul(ll a, ll b);ll power(ll a, ll b);ll div(ll a, ll b);static constexpr ll my_modulus = 1000000007LL;}

ll mymod::add(ll a, ll b){return (a + b) % my_modulus;}
ll mymod::sub(ll a, ll b){return (a + my_modulus - b) % my_modulus;}
ll mymod::mul(ll a, ll b){return ((a % my_modulus) * (b % my_modulus)) % my_modulus;}
ll mymod::power(ll a, ll b){
    if (b == 0) return 1;
    else if (b == 1) return a % my_modulus;
    else if (b % 2 == 0){ll p = power(a, b / 2); return p * p % my_modulus;}
    else return a * power(a, b-1) % my_modulus;
}
ll mymod::div(ll a, ll b){return mul(a, power(b, my_modulus-2));}


int main() {
    ll N;
    cin >> N;
    vector<ll> as(N, 0);
    for (auto &&i: irange(0LL, N)){
        cin >> as.at(i);
    }
    if (N % 2 == 0){
        vector<ll> counts(N / 2, 0);
        for (auto &&i: irange(0LL, N)){
            if (as.at(i) % 2 == 0){
                cout << 0 << endl;
                return 0;
            }
            counts.at((as.at(i) - 1) / 2)++;
        }
        for (auto &&i: irange(0LL, N / 2)){
            if (counts.at(i) != 2){
                cout << 0 << endl;
                return 0;
            }
        }
        cout << mymod::power(2LL, N/2) << endl;
        return 0;
    } else {
        vector<ll> counts(N / 2 + 1, 0);
        for (auto &&i: irange(0LL, N)){
            if (as.at(i) % 2 == 1){
                cout << 0 << endl;
                return 0;
            }
            counts.at(as.at(i)/2)++;
        }
        for (auto &&i: irange(1LL, N/2+1)){
            if (i == 0){
                if (counts.at(i) != 1){
                    cout << 0 << endl;
                    return 0;
                }
            } else {
                if (counts.at(i) != 2){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
        cout << mymod::power(2LL, N / 2) << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
def main(N, lst):
    L = []
    for i in range(len(lst)):
        target = lst[i]
        L.append({"id":i+1, "store":target[0], "point":int(target[1])})
        L.sort(key = lambda x:x["point"], reverse = True)
        L.sort(key = lambda x:x["store"])
    for i in range(len(L)):
        print(L[i]["id"])

N = int(input())
lst = list(list(map(str, input().split())) for _ in range(N))
main(N, lst)

Measured memory_bytes: 3064
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; i++)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#ifdef _DEBUG
#define PRE_COMMAND             \
    std::cin.rdbuf(in.rdbuf()); \
    std::cout << fixed << setprecision(15);
#else
#define PRE_COMMAND cout << fixed << setprecision(15);
#endif
const double EPS = 1e-10, PI = acos(-1.0);
template <class T> auto MAX(T& seq) {
    return *max_element(seq.begin(), seq.end());
}
template <class T> auto MIN(T& seq) {
    return *min_element(seq.begin(), seq.end());
}
template <class T> auto SUM(T& seq) {
    T temp{0};
    auto& temp2 = temp[0];
    return accumulate(seq.begin(), seq.end(), temp2);
}
template <class T> void SORT(T& seq) { sort(seq.begin(), seq.end()); }
template <class T, class S> void SORT(T& seq, S& sort_order) {
    sort(seq.begin(), seq.end(), sort_order);
}
template <class T> void SORTR(vector<T>& seq) {
    sort(seq.begin(), seq.end(), greater<T>());
}
template <class T, class S, class R> long long pow(T n_0, S k_0, R mod_0) {
    long long n = n_0, k = k_0, mod = mod_0, now = 1;
    while (true) {
        if (k & 1) { now = now * n % mod; }
        if ((k >>= 1) == 0) { return now; }
        n = (n * n) % mod;
    }
}
template <typename T> istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}

int main() {
    PRE_COMMAND
    int n, q, t;
    ll u, v;
    cin >> n >> q;
    vl a(n);
    cin >> a;
    atcoder::fenwick_tree<long long> bit(n);
    for (int i = 0; i < n; i++) { bit.add(i, a[i]); }
    REP(i, q) {
        cin >> t >> u >> v;
        if (t == 0) bit.add(u, v);
        if (t == 1) cout << bit.sum(u, v) << endl;
    }
}


Measured memory_bytes: 12152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main(){
  ll a,bb;
  double b;
  cin>>a>>b;
  bb=b*100;
  bb--;
  for(;abs(b*(double)100-bb)>0.5;bb++){}
  cout<<a*bb/100<<endl;
}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<>();

		for(int i=0;i<N;i++) {

			int b = sc.nextInt();

			array.add(b);

		}

		if(array.get(0) != 1) System.out.println(-1);

		else {

			ArrayList<Integer> ans = new ArrayList<>();

			int count = 0;

			boolean flag;

			while(count<N) {

				flag = false;

				for(int i=array.size()-1;i>0;i--) {

					if(array.get(i) == i+1) {

						ans.add(i+1);

						array.remove(i);

						flag = true;

						break;
					}
				}

				if(!flag &&array.size()>1) {

					if(array.get(1) == 1) {

						ans.add(1);

						array.remove(1);

						//continue;
					}
				}
				count++;
			}

			if(ans.size()==N-1 && array.get(0)==1){

				System.out.println(1);

				for(int i=ans.size()-1;i>=0;i--) {

					System.out.println(ans.get(i));
				}
			}else {

				System.out.println(-1);
			}
		}
	}

}


Measured memory_bytes: 23636
N,M = list(map(int,input().split()))
list = []
for i in range(M):
    a,b=input().split()
    list.append((int(a),int(b)))
 
max = 0
min = 10000000000
count = 0
 
for i in range(M):
    if max < list[i][0] :
        count = 0
        max = list[i][0]
    elif max == list[i][0] :
        count += 1
 
for i in range(M):
    if min > list[i][1] :
        min = list[i][1]
   
 
if min >= max:
    print(min - max + 1)
else:
    print(0)

Measured memory_bytes: 16616
using System;

namespace ALDS1_4A_1 {
    public class Program {
        public static void Main(string[] args) {
            var n = int.Parse(Console.ReadLine());
            var an = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);
            Console.ReadLine();
            var tq = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Array.Sort(an);

            var cnt = 0;
            foreach(var t in tq) {
                var left = 0;
                var right = n;
                while(left < right) {
                    var mid = (left + right) / 2;
                    if(an[mid] == t) {
                        cnt++;
                        break;
                    }

                    if(t < an[mid]) right = mid;
                    else left = mid + 1;
                }
            }

            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 9776
// finish date: 2018/02/03
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

// finish date: 2018/01/31
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    int N;
    cin >> N;
    vi a(N), b(N);
    ll asum = 0, bsum = 0;
    rep(i, N) {
        cin >> a[i];
        asum += a[i];
    }
    rep(i, N) {
        cin >> b[i];
        bsum += b[i];
    }
    if (asum > bsum) {
        cout << "No" << endl;
        return 0;
    }
    ll can = bsum - asum;
    ll acount = 0, bcount = 0;
    rep(i, N) {
        if (a[i] > b[i]) bcount += a[i] - b[i];
        else if (a[i] < b[i]) {
            acount += ((ll)b[i] - a[i] + 1) / 2;
            if (((ll)b[i] - a[i]) % 2 == 1) bcount++;
        }
    }
    if ((can-acount)*2==(can-bcount)&&acount<=can&&bcount<=can) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;

}



Measured memory_bytes: 384
// Vicfred
// https://atcoder.jp/contests/abc161/tasks/abc161_c
// math
import std.algorithm;
import std.math;
import std.stdio;

void main() {
    long n, k;
    readf("%s %s\n", &n, &k);

    long res = n%k;

    long minima = min(res, k-res);

    minima.writeln;
}



Measured memory_bytes: 2800
from collections import deque
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
ab = [ tuple( map(int, input().split()) ) for _ in range(N-1) ]
px = [ tuple( map(int, input().split()) ) for _ in range(Q) ]

tree = [[] for _ in range(N)]
for a,b in ab:
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)

score = [0 for _ in range(N)]
for p, x in px:
    p -= 1
    score[p] += x

res = [0 for _ in range(N)]
res[0] = score[0]
visit = [0 for _ in range(N)]
stack = [0]
while stack:
    v = stack.pop()
    visit[v] = 1
    for to in tree[v]:
        if visit[to]:
            continue
        stack.append(to)
        res[to] = res[v] + score[to]

print(*res)

Measured memory_bytes: 116684
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  string s;cin>>s;
  vector<vector<int>> dp(n+1,vector<int>(n+1,0));
  int res=0;
  rep1(i,n){
      rep1(j,n){
          if(s[i-1]==s[j-1])dp[i][j]=dp[i-1][j-1]+1;
          dp[i][j]=min(dp[i][j],abs(i-j));
          res=max(res,dp[i][j]);
      }
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 101104