akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int ans = -1;
    vector<int> V(N+1, -1);
    bool flag = true;
    if (M==0){
        if(N==1) ans = 0;
        else if(N==2) ans = 10;
        else ans = 100;
    }else{
        for(int i=0;i<M;i++){
            int S, C;
            cin >> S >> C;
            if (V[S] == -1) V[S] = C;
            else if (V[S] != C) flag = false;
        }
        if (flag){
            if(N==1) ans = V[1];
            else if (N==2){
                if (V[1] > 0) ans = 10*V[1]+max(0, V[2]);
                else if (V[1] == -1) ans = 10+max(0, V[2]);
            }else{
                if(V[1] > 0) ans = 100*V[1]+10*max(0, V[2])+max(0, V[3]);
                else if (V[1] == -1) ans = 100+10*max(0, V[2])+max(0, V[3]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]

input()
a=sorted(ipt(),reverse=True)
print(sum(a[::2])-sum(a[1::2]))

Measured memory_bytes: 3064
n=int(input())
s=[0]*n
t=[0]*n
for i in range(n):
    s[i],t[i]=input().split()
    t[i]=int(t[i])
x=input()
ans=0
for i in range(n):
    if x==s[i]:
        ans=i
        break
print(sum(t[i+1:]))

Measured memory_bytes: 3316
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

[A,B,C,D]=list(map(int,input().split()))

CD = int(C*D/gcd(C,D))

BokC = B//C
BokD = B//D
BokCD = B//CD
Bika = B - (BokC+BokD-BokCD)

AokC = (A-1)//C
AokD = (A-1)//D
AokCD = (A-1)//CD
Amiman = (A-1) - (AokC+AokD-AokCD)
print(int(Bika-Amiman))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Pi = pair < int, int >;
using Pii = pair < int , Pi >;

constexpr int INF = (1 << 30) - 1;
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
constexpr int mod = 1000000007;

int N, M;
int S[5005];
vector < Pi > nums;
int dp[5005][5005] = {};

int main()
{
        cin >> N >> M;
        
        S[0] = 0;
        for ( int i = 1; i <= N; i++ ) {
                cin >> S[i];
        }

        int maxv = 0;
        int pos = 0;
        for ( int i = 1; i <= N; i++ ) {
                maxv = max(maxv, S[i]);
                if ( maxv == i ) {
                        int p1 = 0, p2 = 0, c1 = 0, c2 = 0;
                        for ( int j = pos + 1; j <= i; j++ ) {
                                if ( p1 < S[j] ) {
                                        p1 = S[j];
                                        c1++;
                                } else if ( p2 < S[j] ) {
                                        p2 = S[j];
                                        c2++;
                                } else {
                                        cout << 0 << endl;
                                        return ( 0 );
                                }
                        }
                        nums.emplace_back(c1, c2);
                        pos = i;
                }
        }

        dp[0][0] = 1;
        int wa = 0;
        for ( int i = 0; i < nums.size(); i++ ) {
                int num1 = nums[i].first;
                int num2 = nums[i].second;
                for ( int j = 0; j <= wa; j++ ) { //左に何個積み上げているのか
                        (dp[i + 1][j + num2] += dp[i][j]) %= mod;
                        (dp[i + 1][j + num1] += dp[i][j]) %= mod;
                }
                wa += num1 + num2;
        }

        int sum = 0;
        for ( int i = N - M; i <= M; i++ ) {
                (sum += dp[nums.size()][N - i]) %= mod;
        }

        cout << sum << endl;

        return ( 0 );
}




Measured memory_bytes: 70048
#include "bits/stdc++.h"
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 sum[100010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, M) {
        int l, r; cin >> l >> r;
        sum[l]++;
        sum[r + 1]--;
    }
    rep(i, N + 1) sum[i + 1] += sum[i];
    int ans = 0;
    REP(i, 1, N) {
        if (sum[i] == M) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

int main() {
  int n;
  cin >> n;
  FOR(i, 1, 10) {
    FOR(j, 1, 10) {
      if (i * j == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int M = 307;
const int inf = 1e9;


int n, m;
int d[M][M];
int c[M][M];
string s[M];

int cost(string s, string t) {
  for (int i = 0; i < M; ++i)
    for (int j = 0; j < M; ++j)
      d[i][j] = inf;

  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      c[i][j] = c[i - 1][j - 1] + (s[i - 1] == t[j - 1] ? 1 : 0);
    }

  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j) {
      if (i == 0 && j == 0) {
        d[i][j] = 0;
        continue;
      }

      if (i > 0) {
        d[i][j] = min(d[i][j], d[i - 1][j]);
      }

      if (j > 0) {
        d[i][j] = min(d[i][j], d[i][j - 1]);
      }

      d[i][j] += c[i][j];
    }

  return d[n][n];
}

void read() {
  cin >> n >> m;
  for (int i = 0; i < m; ++i)
    s[i].resize(n);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      cin >> s[j][i];


  int ans = 0;
  for (int i = 0; i + 1 < m; ++i)
    ans += cost(s[i], s[i + 1]);

  cout << ans << endl;
}


void kill() {

}

int main() {
  cout.precision(20);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  read();
  kill();
}


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

namespace JSC2019
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] md = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] mdd = new int[3];
            int ans = 0;
            for (int i = 4; i <= md[0]; i++)
            {
                for (int j = 22; j <= md[1]; j++)
                {
                    if (j % 10 <= 1) { }
                    else if (i == (j / 10) * (j % 10)) { ans++; }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

S = list(input() for _ in range(n))
from collections import Counter

c = Counter(S).most_common()

max_cnt = c[0][1]
lst = []

for i in c:
  if i[1] != max_cnt:
    break
  else:
    lst.append(i[0])
    

for node in sorted(lst):
  print(node)

Measured memory_bytes: 123344
from heapq import heapify, heappush, heappop
N = int(input())
A = []
for i in range(N):
    A.append(tuple(map(int, input().split())))
A.sort()

B = []
for i in range(N):
    B.append(tuple(map(int, input().split())))
B.sort()

heap = []
heapify(heap)
aindex = count = 0
for b in B:
    while aindex < len(A) and A[aindex][0] < b[0]:
        heappush(heap, -A[aindex][1])
        aindex += 1
    buf = []
    while heap and b[1] <= -heap[0]:
        ay = heappop(heap)
        buf.append(ay)
    if heap and -heap[0] < b[1]:
        count += 1
        heappop(heap)
    for ay_ in buf:
        heappush(heap, ay_)
print(count)

Measured memory_bytes: 8900
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define per(i,j,n) for(int i=(int)(j);(int)(n)<=i;i--)
#define int long long
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define endl "\n"
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<vi>
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=(1ll<<62)-1;
signed main(){
  ll A,B,C; cin>>A>>B>>C;
  if(A>B) swap(A,B);
  string ans="No";
  if(A<=C&&C<=B) ans="Yes";
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    from math import floor
    a,b,n = readInts()

    p = min(b-1,n)
    #print(p)
    print(floor(a*p/b) - a*floor(p/b))


if __name__ == '__main__':
  main()


Measured memory_bytes: 10928
import java.util.*;
class CostEdge{
    int to;
    int distance;
    int cost;
    public CostEdge(int t, int d, int c){
        this.to = t;
        this.distance = d;
        this.cost = c;
    }
}
class Node{
    int d;
    int p;
    public Node(int d, int p){
        this.d = d;
        this.p = p;
    }
}
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            if(n==0&&m==0)return;
            List<List<CostEdge>> g = new ArrayList<List<CostEdge>>();
            for(int i=0; i<n; i++)
                g.add(new ArrayList<CostEdge>());
            for (int i = 0; i < m; i++) {
                int u = sc.nextInt();
                int v = sc.nextInt();
                int d = sc.nextInt();
                int c = sc.nextInt();
                CostEdge e1 = new CostEdge(v-1, d, c);
                CostEdge e2 = new CostEdge(u-1, d, c);
                g.get(u-1).add(e1);
                g.get(v-1).add(e2);
            }
            int[] d = new int[n];
            Arrays.fill(d, Integer.MAX_VALUE);
            d[0] = 0;
            int[] ans = new int[n];
            Arrays.fill(ans, Integer.MAX_VALUE);
            ans[0] = 0;
            dijkstra(0, d, g, ans);
            int res = 0;
            for(int i=0; i<n; i++)
                res += ans[i];
            System.out.println(res);
        }
    }
    public static void dijkstra(int s, int[] d, List<List<CostEdge>> graph, int[] ans){
        PriorityQueue<Node> pq = new PriorityQueue<>(10, new Comparator<Node>() {
            @Override
            public int compare(Node o1, Node o2) {
                return o1.d - o2.d;
            }
        });
        pq.offer(new Node(0, s));
        while(!pq.isEmpty()){
            Node nd = pq.poll();
            if(d[nd.p] < nd.d) continue;
            for(int i=0; i<graph.get(nd.p).size(); i++){
                CostEdge e = graph.get(nd.p).get(i);
                if(d[e.to] > d[nd.p] + e.distance){
                    d[e.to] = d[nd.p] + e.distance;
                    ans[e.to] = e.cost;
                    pq.offer(new Node(d[e.to], e.to));
                }
                else if(d[e.to] == d[nd.p] + e.distance)
                    ans[e.to] = Math.min(ans[e.to], e.cost);
            }
        }
    }
}


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

using lint = long long;
#define reps(i, a, n) for (lint i = (a); i < (lint)(n); ++i)
#define rep(i, n) reps(i, 0, n)
struct pre_{pre_(){cin.tie(0);ios::sync_with_stdio(0);}} pre__;

struct P {
  int x, y;
};

inline bool inside(int x, int y, int w, int h) {
  return 0 <= x && x < w && 0 <= y && y < h;
}

bool field[5010][5010];

signed main() {
  int n;

  while (cin >> n, n) {
    vector<P> p(n);
    memset(field, false, sizeof(field));
    rep(i, n) {
      cin >> p[i].x >> p[i].y;
      field[p[i].x][p[i].y] = true;
    }
    int res = 0;
    rep(i, n) rep(j, n) {
      if (i == j) continue;
      P d = (P){abs(p[i].x - p[j].x), abs(p[i].y - p[j].y)};
      P next1 = (P){p[i].x + d.y, p[i].y - d.x},
        next2 = (P){p[j].x + d.y, p[j].y - d.x};
      if (!inside(next1.x, next1.y, 5001, 5001)) continue;
      if (!inside(next2.x, next2.y, 5001, 5001)) continue;
      if (field[next1.x][next1.y] && field[next2.x][next2.y]) {
        res = max(res, d.x * d.x + d.y * d.y);
      }
    }
    cout << res << '\n';
  }
}

Measured memory_bytes: 27624
from copy import deepcopy


def dfs(v, n, r, visited):
    visited[v] = 1
    ret = 1
    for w in range(n):
        if [v, w] not in r:
            continue
        elif visited[w] == 1:
            continue
        ret += dfs(w, n, r, visited)
        visited[w] = 1
    return ret


n,m = map(int,input().split())
x = []
cnt = 0
for _ in range(m):
    a,b = map(int,input().split())
    x.append([a-1,b-1])
    x.append([b-1, a-1])
for i in range(m):
    r = deepcopy(x)
    r.pop(2*i)
    r.pop(2*i)
    visited = [0]*n
    if dfs(0, n, r, visited) == n:
        cnt += 1
print(m-cnt)

Measured memory_bytes: 3572
s = input()
k = int(input())
a =[chr(ord('a') + i) for i in range(26)]

tar = set()
alpha_idx = 0
while len(tar) < k:
    alpha = a[alpha_idx]
    for i in range(len(s)):
        if s[i] == alpha:
            for j in range(i+1, min(len(s)+1,i+1+k)):
                tar.add(s[i:j])
    alpha_idx += 1
tar = list(tar)
tar.sort()
print(tar[k-1])



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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  string s;
  int k;
  cin >> s >> k;

  set<string> st;
  for (char c = 'a'; c <= 'z'; c++) {
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != c) continue;

      for (int j = 1; j <= 5; j++) {
        st.insert(s.substr(i, j));
      }
    }
    if (st.size() >= k) break;
  }

  // 解答
  set<string>::iterator it = st.begin();
  advance(it, k - 1);
  cout << *it << endl;

  return 0;
}


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

#define FAST        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll          long long
#define ull         unsigned long long
#define all(a)      a.begin(), a.end()
#define rall(a)     a.rbegin(), a.rend()
#define pii         pair<int, int>
#define mod         1000000007
#define PI          acos(-1)

using namespace std;



int main (){
    //FAST;
    //freopen("input.txt", "r", stdin);

    string s1, s2;
    cin>>s1>>s2;

    //map<char, int> mp1, mp2;
    int cnt = 0;

    for(int i=0; i<s1.size(); i++){
        if(s1[i] != s2[i]) cnt++;
    }
    cout<<cnt<<endl;




    return 0;
}



Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll md = 1000000007;
vector<ll> fact(1e6 + 7), invfact(1e6 + 7);

ll fn(ll a, ll r, ll n, ll mod = md) {
    ll res = 1, x = r%mod;
    ll ans = 0;
    while(n) {
        if(n&1) ans = (x*ans + res)%mod;
        res = ((res*x)%mod + res%mod)%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    ans = (ans*a)%mod;
    return ans;
}

ll nCr(ll n, ll r) {
    if(r == 0) return 1;
    ll num = fact[n];
    ll den = (invfact[r] % md *invfact[n-r] % md)%md;
    return (num*den)%md;
}

ll mul(ll a, ll b, ll mod = md) {
    ll res = (a%mod * b%mod)%mod;
    return res;
}

ll mulm(ll a, ll b, ll mod = md) {
    ll r = 0;
    a %= mod;
    while (b) {
        if (b & 1) r = (r+a)%mod;
        a = (a+a)%mod;
        b = b/2;
    }
    r %= mod;
    return r;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = n/2;
        x = (x*x)%mod;
    }
    return res;
}

ll power2(ll x, ll n) {
    ll res = 1;
    while (n)  
    {  
        if (n & 1)  res = (res*x);  
        n = n/2; 
        x = (x*x);  
    }  
    return res;
}

bool is_prime(ll x) {
    if(x == 1 || x == 0) return false;
    for(int i=2; i*i <= x; i++) {
        if(x%i == 0) return false;
    }
    return true;
}

ll compgcd(ll n, vector<ll> const &primes) { 
    ll res = n; 
    for (ll i=0; primes[i]*primes[i] <= n; i++) {
        if (n % primes[i]== 0) { 
            res -= (res / primes[i]); 
            while (n%primes[i]== 0) {
               n/=primes[i]; 
            }
        } 
    } 
    if (n > 1) {
       res -= (res / n); 
    }
    return res; 
} 

void sieve(vector<bool> &prime, vector<ll> &primes, ll lim) {
    for(int i = 2; i*i <= lim; i++) {
        if(prime[i]) {
            for(int j = 2; j*i <= lim; j++) {
                prime[j*i] = false;
            }
        }
    }
    for(int i = 2; i <= lim; i++) {
        if(prime[i]) {
            primes.push_back(i);
        }
    }
}

void sieveGCD(ll lim, vector<ll> &tab, vector<ll> const &primes) {
    for(int  i = 1; i <= lim; i++) {
        tab[i] = i;
    }
    for(int i = 0; i<primes.size() && primes[i] <= lim; i++) {
        tab[primes[i]] = primes[i]-1;
        for(int j = 2; primes[i]*j <= lim; j++) {
            tab[primes[i]*j] = (tab[primes[i]*j]/primes[i])*(primes[i]-1);
        }
    }
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b;
    cin >> a >> b;
    if((a*b)%2 == 0) { 
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }
    return 0; 
}

Measured memory_bytes: 15872
def main():
	n = int(input())
	s = list(str(input()))
	ans = 0
	for i in range(n-2):
		if s[i] == 'A' and s[i+1] == 'B' and s[i+2]=='C' :
			ans += 1
	print(ans)
			

	
 
if __name__ == '__main__':
	main()

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

int main(){
	string s;

	getline( cin, s );

	for ( unsigned i = 0; i < s.size(); ++i ){
		if ( s[ i ] >= 'a' && s[ i ] <= 'z' ){
			s[ i ] = s [ i ] - 'a' + 'A';
		}
	}

	cout << s << endl;

	return 0;
}

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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)

ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

ll modm(ll val, ll m) {
  ll res = val % m;
  if (res < 0) res += m;
  return res;
}

int main(){
    ios_base::sync_with_stdio(false);
    ll n,m,k,a,ans=0;
    cin >> n >> m;
    vector<ll> s(m,0);
    rep(i,n){
      cin >> k;
      for(int j=0;j<k;j++){
        cin >> a;
        a--;
        s[a]++;
      }
    }
    rep(c,m){
      if(s[c]==n){
        ans++;
      }
    }

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


Measured memory_bytes: 3604
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    S = [0] * N  # 累積和
    S[0] = A[0]
    for n in range(1, N):
        S[n] = S[n - 1] + A[n]
    n = N - 2
    while n >= 0:
        if 2 * S[n] < A[n + 1]:  # A_n までの数字で A_(n+1)を吸収できない
            break
        n -= 1
    print(N - 1 - n)


if __name__ == '__main__':
    main()


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

int main(){
  int n,ans=0;
  cin>>n;
  int m=n;
  for (int i=0;m>0;i++){
    ans+=m%10;
    m/=10;
  }
  if (n%ans==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int a,b;
    char c;
    scanf("%d %c %d", &a, &c, &b);
    if (c == '+')
    {
        printf("%d", a + b);
    }
    
    else
    {
        printf("%d", a - b);
    }
}

Measured memory_bytes: 1732
N=int(input())
S=[]
for i in range(N):
    S.append(input())
M=int(input())
T=[]
for i in range(M):
    T.append(input())
SS=list(set(S))
TS=list(set(T))
ans=0
for i in range(len(SS)):
    a=S.count(SS[i])
    b=T.count(SS[i])
    ans=max(ans,a-b)
print(ans)

Measured memory_bytes: 3064
//ABC154B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++){
		cout << "x";
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

int main(void)
{
  int x,y;
  int range_min, range_max;
  int count_1=0, count_5=0, count_10=0;
  int i,j;
  int money;
  scanf("%d %d", &x,&y);
  range_min=x*1000;
  range_max=x*10000;
  int y_t=y/1000;
  
  int diff=y_t-x;
  for (i=0; i <= x; ++i){
    for (j=0; j <= (x-i); ++j){
      money=4*i+9*j;
      if (money == diff){
	count_10=j;
	count_5=i;
	count_1=x-count_10-count_5;
	printf("%d %d %d\n",count_10,count_5,count_1);
	return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
  return 0;
}

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

int main() {
  int n,d,x,ate = 0;
  cin >> n >> d >> x;
  for(int i = 0;i < n;i++){
    int a,day = 1,c = 1;
    cin >> a;
    while(day <= d){
      ate++;
      day = 1+a*c;
      c++;
    }
  }
  cout << ate+x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

ll N, A[100000];

vector<ll> solve(ll s) {
    vector<ll> ret = {s};
    ll before = s;
    REP(i, N) {
        before = 2 * A[i] - before;
        ret.push_back(before);
    }
    return ret;
}

int main() {
    cin >> N;
    REP(i, N) cin >> A[i];
    vector<ll> ans = solve(0);

    if (ans[0] != ans[ans.size() - 1]) {
        ans = solve((ans[0] + ans[ans.size() - 1]) / 2);
    }
    REP(i, ans.size() - 1) cout << ans[i] << " "; cout << endl;
    return 0;
}

Measured memory_bytes: 3316
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    
    if(N === 1) {
        console.log("Hello World");
        return;
    }
    
    const A = parseInt(arg[1].split(" ")[0]);
    const B = parseInt(arg[2].split(" ")[0]);
    
    console.log(A + B);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
    int N;
    int W[100];
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> W[i];
    }
    int ans = 1000000;
    for (int i = 0; i < N-1; i++)
    {
        int S1 = 0;
        int S2 = 0;
        for (int j = 0; j < i+1; j++)
        {
            S1 += W[j];
        }
        for (int j = i+1; j < N; j++)
        {
            S2 += W[j];
        }
        ans = min(abs(S1-S2),ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,i,j,k,count=0;
	int x;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	for(i=0;i<=a;i++)
	{
		for(j=0;j<=b;j++)
		{
			for(k=0;k<=c;k++)
			{
				if(500*i+100*j+50*k==x)
				{
					count++;
				}
			}
		}
	}
	printf("%d",count);
	return 0;
}


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

int main () {
 int n; cin >> n;
 vector<ld> a(n);
 ld sum=1;
 rep(i,n){
   cin >> a[i];
   if(a[i]==0){
     cout << 0 << endl;
     return 0;
   }
 }
 rep(i,n){
   sum*=a[i];
   if(sum>1000000000000000000){
     cout << -1 <<endl;
    return 0;
     }
 }
 cout << (ll)sum << endl;
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
  ll n, w;
  cin >> n >> w;
  vector<vector<ll>> q(4);

  ll w1;
  REP(i, n) {
    ll a, b;
    cin >> a >> b;
    if (i == 0) w1 = a;
    a -= w1;
    q[a].push_back(b);
  }

  REP(i, 4) {
    q[i].push_back(0);
    sort(ALL(q[i]), greater<ll>());
  }

  ll ans = 0;
  REP(i, q[0].size() + 1)
  REP(j, q[1].size() + 1) REP(k, q[2].size() + 1) REP(l, q[3].size() + 1) {
    ll sum = i * (w1) + j * (w1 + 1) + k * (w1 + 2) + l * (w1 + 3);

    if (sum > w) continue;

    ll tmp = 0;
    REP(m, i) tmp += q[0][m];
    REP(m, j) tmp += q[1][m];
    REP(m, k) tmp += q[2][m];
    REP(m, l) tmp += q[3][m];

    ans = max(ans, tmp);
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << "\n\n"
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

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];
    if (i != len - 1)
      cout << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) {
    cin >> A[i];
  }

  ll leng = 0;
  rep(i, N) {
    leng += A[i];
  }

  vector<ll> sum(N + 1);
  rep(i, N) {
    sum[i + 1] = sum[i] + A[i];
  }

  ll ans = LINF;
  rep(i, N - 1) {
    chmin(ans, abs(2 * sum[i + 1] - leng));
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3328
pypy -cH,W,A,B=`tr \  ,`';M=10**9+7;Z=C=1
for I in range(H-1):Z=C=C*(W+H-B-2-I)*pow(I+1,M-2,M)%M
for I in range(1,H-A):C=C*(B-1+I)*(H-I)*pow(I*(W+H-B-1-I),M-2,M)%M;Z+=C
print Z%M'

Measured memory_bytes: 32912
#include<stdio.h>
int main(void)
{
  int a[3];

  scanf("%d%d%d",&a[0],&a[1],&a[2]);

  int i,j,temp;
  for(i=0;i<3;i++){
    for(j=3-1;j>i;j--){
      if(a[j] < a[j-1]){
        temp = a[j];
        a[j] = a[j-1];
        a[j-1] = temp;
      }
    }
  }

  printf("%d",a[0]+a[1]);

  return 0;
}


Measured memory_bytes: 128
N=int(input())
a=list(map(int,input().split()))
b=0

if (N%2 == 0):
  c=N//2
else:
  c=N//2 + 1

for i in range(c):
  if (a[2*i] %2 !=0):
    b +=1

print(b)

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

int main(){
    int a, b, c;
    int count = 0;
    
    cin >> a >> b >> c;
    
    for (int i=a; i <= b; i++){
        if (c % i == 0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3092
N, W = map(int, input().split())

values = [0] * N
weights = [0] * N

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    values[i], weights[i] = map(int, input().split())

for i in range(N):
    for w in range(W+1):
        if w >= weights[i]:
            dp[i+1][w] = max(dp[i][w-weights[i]] + values[i], dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])



Measured memory_bytes: 42268
#!/usr/bin/env python3
#ABC66 D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def f(a, b):
    if b == 0: 
        return 1
    if b % 2 == 0:
        d = f(a, b // 2)
        return d * d % mod
    if b % 2 == 1:
        return (a * f(a, b - 1)) % mod


def comb(n,r):
    if n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n-r] % mod

n = I()
a = LI()
cnt = [0]*(n+1)
for i in range(n+1):
    if cnt[a[i]]:
        a = cnt[a[i]]
        b = i+1
        break
    else:
        cnt[a[i]] = i+1

fact = [1]*(n+2)
invfact = [1]*(n+2)
for i in range(1,n+2):
    fact[i] = i*fact[i-1] % mod
    invfact[i] = invfact[i-1] * f(i,mod-2) % mod

for i in range(n+1):
    res = 0
    res = (res + comb(n+1,i+1)) % mod
    res = (res - comb((a-1)+(n+1-b),i)) % mod
    print(res)
    

Measured memory_bytes: 69080
m,f,r,t;
main(){
    char c;
    for(;scanf("%d%d%d",&m,&f,&r),m+f+r+3!=0;){
        t=m+f;
        c=m==-1||f==-1?'F'
                :t>=80?'A'
                :t>=65?'B'
                :t>=50||r>=50?'C'
                :t>=30?'D'
                      :'F';
        printf("%c\n",c);
    }
}

Measured memory_bytes: 1848
#include <stdio.h>
#include <string.h>

#define MAX_HEAP_SIZE   2000000
#define CONTINUE        1
#define STOP            0

int HeapSize;
int Heap[MAX_HEAP_SIZE];

void initVer(void){
    int i;
    
    HeapSize = 0;
    
    for( i = 0; i < MAX_HEAP_SIZE; i++ ){
        Heap[i] = 0;
    }
}

void inputVal(void){
    int i;
    
    scanf("%d",&HeapSize);
    for( i = 1; i <= HeapSize; i++ ){
        scanf("%d",&Heap[i]);
    }
}

void maxHeapify(int Node){
    int LeftNode;
    int RightNode;
    int LargetNode;
    int TmpHeapVal;
    
    LeftNode = 2 * Node;
    RightNode = LeftNode + 1;
    
    if( ( LeftNode <= HeapSize ) && ( Heap[LeftNode] > Heap[Node] ) ){
        LargetNode = LeftNode;
    }else{
        LargetNode = Node;
    }
    
    if( ( RightNode <= HeapSize ) && ( Heap[RightNode] > Heap[LargetNode] ) ){
        LargetNode = RightNode;
    }
    
    if( LargetNode != Node ){
        TmpHeapVal = Heap[Node];
        Heap[Node] = Heap[LargetNode];
        Heap[LargetNode] = TmpHeapVal;
        maxHeapify(LargetNode);
    }
}

void buildMaxHeap(void){
    int i;
    
    for( i = HeapSize / 2; i > 0; i-- ){
        maxHeapify(i);
    }
}

void outputVal(void){
    int i;
    
    for( i = 1; i <= HeapSize; i++ ){
        printf(" %d",Heap[i]);
    }
    printf("\n");
}

void insertVal(int insertval){
    int tmpNode;
    int TmpHeapVal;
    HeapSize++;
    tmpNode = HeapSize;
    Heap[HeapSize] = insertval;
    while(tmpNode > 1 && Heap[tmpNode/2] < Heap[tmpNode]){
        TmpHeapVal = Heap[tmpNode];
        Heap[tmpNode] = Heap[tmpNode/2];
        Heap[tmpNode/2] = TmpHeapVal;
        tmpNode = tmpNode/2;
    }
}

int deleteMaxVal(void){
    int ret;
    ret = -1;
    
    if(HeapSize >= 1){
        ret = Heap[1];
        Heap[1] = Heap[HeapSize];
        HeapSize--;
    }
    return ret;
}

void inputCommand(char *command,int *key){
    scanf("%s",command);
    if(strcmp(command,"insert") == 0){
        scanf("%d",key);
    }
}

int judgeCommand(char *command,int *key){
    int ret;
    int outputVal;
    ret = CONTINUE;
    if(strcmp(command,"insert") == 0){
        insertVal(*key);
    }else if(strcmp(command,"extract") == 0){
        outputVal = deleteMaxVal();
        maxHeapify(1);
        printf("%d\n",outputVal);
    }else if(strcmp(command,"end") == 0){
        ret = STOP;
    }else{
        ;
    }
    return ret;
}

int main(void){
    char command[10];
    int key;
    int roopFlag;
    
    roopFlag = CONTINUE;
    initVer();
    
    while(roopFlag == CONTINUE){
        inputCommand(command,&key);
        roopFlag = judgeCommand(command,&key);
    }
}











Measured memory_bytes: 9536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public long N;
        public long[] A;
        public void Run()
        {
            N = Input.ReadLong();
            A = Input.ReadLongArray();

            long S = A.Sum();
            long X = N * (N + 1) / 2;

            if (S % X != 0)
            {
                Console.WriteLine("NO");
                return;
            }

            long T = S / X;

            long C = 0;
            for (int i = 0; i < N; i++)
            {
                long d = A[i] - (i == 0 ? A[N - 1] : A[i - 1]);
                long dd = T - d;
                if (dd % N != 0 || dd / N < 0)
                {
                    Console.WriteLine("NO");
                    return;
                }

                C += dd / N;
            }

            if (T == C)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 21344
/* ex3_4
    sak_Citrus*/

#include <stdio.h>

int main(void){
    //標準入力
    int n;
    scanf("%d",&n);
    for(int i=1;i<10;i++){
        //nがiで割り切れてなおかつその商が10未満なら
        if(n%i == 0 && n/i < 10){
            printf("Yes\n");
            break;
        }
        //最後までbreakされなかったら九九にはない
        if(i == 9)
            printf("No\n");
    }

}

Measured memory_bytes: 128
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}

vi adj[201010];
int ans, n, x, y, dp[202020];

int dia(int cur,int prev,int depth)
{
	int best=depth;
	int i;
	for(i=0;i<adj[cur].size();i++)
	{
		int v=adj[cur][i];
		if(v!=prev)
		{
			int tmp=dia(v,cur,depth+1);
			ans=max(ans,best+tmp-2*depth);
			best=max(best,tmp);
		}
	}
	return best;
}

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

cin >> n;

rep(i, 1, n-1){
    cin >> x >> y;
    adj[x].pb(y);
    adj[y].pb(x);
}

dia(1, 0, 1);

//cout << ans << endl;
ans++;

dp[1]=1;
dp[0]=0;

for(int i=3;i<=200000;i++){
   dp[i] = ( dp[i-1]+dp[i-2] )%2;
}

if(dp[ans]){
   cout << "First" << endl;
}
else {
   cout << "Second" << endl;
}


return 0;
}
///....


Measured memory_bytes: 27776
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]


MPs = {}
# この書き方でa,bが取り出せる
for a, b in ABs:
    a = int(a)  # intに直すには先に直しておく
    b = int(b)
    if a not in MPs:
        MPs[a] = 1
    else:
        MPs[a] += 1
    if b not in MPs:
        MPs[b] = 1
    else:
        MPs[b] += 1

for mp in range(1, N+1):
    if mp not in MPs:
        print(0)
    else:
        print(MPs[mp])

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int main(){
    ll N, A, B; cin >> N >> A >> B;
    vl x(N);
    rep(i, 0, N) cin >> x[i];
    ll cur=x[0];
    ll ans = 0;
    rep(i, 0, N){
        ll fuelA = (x[i] - cur) * A;
        if(fuelA < B){
            ans += fuelA; 
        } else {
            ans += B; 
        }
        cur = x[i];
    }
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 1024
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int bit[505];
void add(int x){
	while(x<=500){
		bit[x]++;
		x+=(x&-x);
	}
}
int sum(int x){
	int ret=0;
	while(x){
		ret+=bit[x];
		x&=x-1;
	}
	return ret;
}
int calc(int l,int r){
	return sum(r)-sum(l-1);
}
vector<pair<int,int> >qry[505];//l-><r,id>
int n,m,q;
vector<int>train[505];//l->r
int ans[200005];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>m>>q;
	for(int i=1;i<=m;i++){
		int l,r;
		cin>>l>>r;
		train[l].push_back(r);
	}
	for(int i=1;i<=q;i++){
		int l,r;
		cin>>l>>r;
		qry[l].push_back(make_pair(r,i));
	}
	for(int i=n;i>=1;i--){
		for(auto x:train[i])add(x);
		for(auto p:qry[i]){
			int l=i,r=p.first,id=p.second;
			ans[id]=calc(l,r);
		}
	}
	for(int i=1;i<=q;i++)cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			int a = sc.nextInt();
			
			System.out.println(a + a*a + a*a*a);




		}catch(Exception e) {
			e.printStackTrace();
		}

	}

	
}

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

int main(){
  string str;
  cin >> str;
  bool is_c = false;
  for(int i=0;i<str.size();i++){
    if(str[i] == 'C'){
      is_c = true;
    }
    if(is_c && str[i] == 'F')
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
L=100000000
h,w=gets.split.map &:to_i
ch,cw=gets.split.map &:to_i
dh,dw=gets.split.map &:to_i
cp=(w+4)*(ch+1)+cw+1
dp=(w+4)*(dh+1)+dw+1
d=w+4
f=[nil]*( (h+4)*(w+4) )
h.times{|i|
  gets.chomp.each_char.with_index{|c,j|
    next if c==?#
    f[d*(i+2)+j+2]=L
  }
}
qc=[cp]
qn=[]
dns=[-d,-1,1,d]
dms=(-2..2).flat_map{|i|
  (-2..2).each_with_object([]){|j,r|
    e=i*d+j
    r.push(e) if e.abs>1 && e.abs!=d
  }
}
#p [cp,dp,dns,dms,f]
0.step{|x|
  break if qc.empty? && qn.empty?
  until qc.empty?
    e=qc.pop
    next if f[e]<=x
    f[e]=x
    dns.each{|y|
      qc.push(e+y) if f[e+y]
    }
    dms.each{|y|
      qn.push(e+y) if f[e+y]
    }
  end
  qc=qn
  qn=[]
}
puts f[dp]==L ? -1 : f[dp]


Measured memory_bytes: 26832
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P       = pair<int, int>;

template <class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int n;cin>>n;
    string s;cin>>s;
    int k;cin>>k;
    k--;
    char t = s[k];
    string ans;
    for(auto c:s){
        if(c != t) {
            ans += '*';
        } else {
            ans += c;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 888
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {
  int h, n;
  scanf("%d %d", &h, &n);

  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    int ai;
    scanf("%d", &ai);
    a[i] = ai;
  }

  int sa = accumulate(a.begin(), a.end(), 0);

  cout << ((sa >= h)? "Yes" : "No")  << endl;
  
  return 0;
}


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

int N;

int dfs(vector<string> s) {

    char op = s[0][0];
    int ans;
    if (op == '+') {
        ans = 0;
        auto s_ = s;
        s_.erase(s_.begin());
        for (auto& i : s_)
            i = string(i.begin() + 1, i.end());
        vector<string> tmp;
        for (auto i : s_) {
            if ('0' <= i[0] && i[0] <= '9') {
                if (tmp.size() > 0) ans += dfs(tmp);
                ans += (int)(i[0] - '0');
                tmp.resize(0);
            } else if (i[0] == '*' || i[0] == '+') {
                if (tmp.size() > 0) ans += dfs(tmp);
                tmp.resize(0);
                tmp.push_back(i);
            } else {
                tmp.push_back(i);
            }
        }
        if (tmp.size() > 0)
            ans += dfs(tmp);
    }
    else if (op == '*') {
        ans = 1;
        auto s_ = s;
        s_.erase(s_.begin());
        for (auto& i : s_)
            i = string(i.begin() + 1, i.end());
        vector<string> tmp;
        for (auto i : s_) {
            if ('0' <= i[0] && i[0] <= '9') {
                if (tmp.size() > 0) ans *= dfs(tmp);
                ans *= (int)(i[0] - '0');
                tmp.resize(0);
            } else if (i[0] == '+' || i[0] == '*') {
                if (tmp.size() > 0) ans *= dfs(tmp);
                tmp.resize(0);
                tmp.push_back(i);
            } else {
                tmp.push_back(i);
            }
        }
        if (tmp.size() > 0)
            ans *= dfs(tmp);
    }
    else {
        ans = (int)(op - '0');
    }

    return ans;
}

void solve() {
    vector<string> v(N);
    for (auto& i : v) cin >> i;

    cout << dfs(v) << endl;
}

int main() {
    while (cin >> N, N) solve();

    return 0;
}

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

int cnt[3];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    for (int i = 0; i < S.length(); i++) {
        cnt[S[i] - 'a']++;
    }
    if (abs(cnt[0] - cnt[1]) <= 1 && abs(cnt[1] - cnt[2]) <= 1 && abs(cnt[2] - cnt[0]) <= 1) {
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 512