akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	static long MOD = 1000000007;

	static long add(long x, long y) {
		x += y;
		if (x >= MOD) return x - MOD;
		return x;
	}

	static long mult(long x, long y) {
		return (x * y) % MOD;
	}

	static long mult(long x, long y, long z) {
		return mult(x,  mult(y, z));
	}

	static long pow(long base, long exp) {
		if (exp == 0) return 1;
		if ((exp & 1) == 1) return mult(base, pow(base, exp - 1));
		return pow(mult(base, base), exp / 2);
	}

	static long inverse(long x) {
		return pow(x, MOD - 2);
	}

	static long[] getPots(long base, int max) {
		long[] ret = new long[max + 1];
		ret[0] = 1;
		for (int i = 1; i <= max; i++) {
			ret[i] = mult(ret[i-1], base);
		}
		return ret;
	}

	static long[] getFacts(int max) {
		long[] ret = new long[max + 1];
		ret[0] = 1;
		for (int i = 1; i <= max; i++) {
			ret[i] = mult(ret[i-1], i);
		}
		return ret;
	}

	static long[] getInvFacts(int max) {
		long[] ret = new long[max + 1];
		ret[max] = 1;
		for (int i = 1; i <= max; i++) {
			ret[max] = mult(ret[max], i);
		}
		ret[max] = inverse(ret[max]);
		for (int i = max - 1; i >= 0; i--) {
			ret[i] = mult(ret[i+1], i+1);
		}
		return ret;
	}


	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int K = sc.nextInt();
		int N = sc.next().length();
		long[] pots = getPots(25, K + N);
		long[] facts = getFacts(K + N);
		long[] invFacts = getInvFacts(K + N);
		long ans = 0;
		for (int i = N; i <= N + K; i++) {
			long tmp = mult(invFacts[i], invFacts[N + K - i], pots[N + K -i]);
			ans = add(ans, tmp);
		}
		ans = mult(ans, facts[N + K]);
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 85408
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

    int n;
    cin >> n;
    string s;
    cin >> s;

    ll res = 1;

    auto pre = s[0];
    for (int i = 1; i < n; i++)
    {
        if (s[i] != pre) {
            res++;
        }
        pre = s[i];
    }
    cout << res << "\n";
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	ll res = min(b, c) * 2;
	b -= res / 2;
	c -= res / 2;
	if (b)
		res += b;
	else
		res += min(c, a + 1);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
/*
ID: andy.sc1
LANG: JAVA
TASK: drinks
*/

// Imports
import java.util.*;
import java.io.*;

public class Main {

    /**
     * @param args the command line arguments
     * @throws IOException, FileNotFoundException 
     */
    public static void main(String[] args) throws IOException, FileNotFoundException {
        
        // TODO UNCOMMENT WHEN ALGORITHM CORRECT
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        
        
        // TODO code application logic here
        int n = Integer.parseInt(f.readLine());
        int[] m = new int[n];
        
        StringTokenizer problems = new StringTokenizer(f.readLine());
        int sum = 0;
        for(int i = 0; i < n; i++) {
            int l = Integer.parseInt(problems.nextToken());
            m[i] = l;
            sum += l;
        }
        
        // System.out.println(Arrays.toString(m));
        
        int a = Integer.parseInt(f.readLine());
        for(int i = 0; i < a; i++) {
            StringTokenizer drink = new StringTokenizer(f.readLine());
            int b = Integer.parseInt(drink.nextToken());
            int c = Integer.parseInt(drink.nextToken());
            System.out.println((sum - m[b - 1] + c));
        }
    }

}


Measured memory_bytes: 21204
import java.util.*;
import java.io.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    public static void main(String args[]) {
        int t = 1;//ni();
        while (t-- > 0) {
            solve();
        }
        out.close();
    }

    static long mod = (long) 1e9 + 7;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static int maxn = 100005;

    static class sort implements Comparator<String> {
        public int compare(String a, String b) {
            return a.length() - b.length();
        }
    }

    static long func(long a, long b, long x) {
        return ((a * x) / b) - (a * (x / b));
    }

    static void solve() {
        long a = nlo();
        long b = nlo();
        long n = nlo();
//        for (int i = 1; i <= n; i++)
//            out.println(func(a,b,i));
        if (b <= n)
            out.println(func(a, b, b - 1));
        else
            out.println(func(a, b, n));
    }
}

Measured memory_bytes: 32548
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a[5];
  for(int i=0;i<5;i++)
  {
    cin >> a[i];
  }
  for(int i=0;i<5;i++)
  {
    if(a[i]==0)
    {
      cout << i+1 << endl;
      return 0;
    }
  }
}

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

int main(){
    int X,syou=0;
    cin >> X;

    if(X < 99)
        cout << 0 << endl;
    else if(X >= 2000)
        cout << 1 << endl;
    else{
        syou = X / 100;
        if(X <= (syou * 100 + syou * 5))
            cout << 1 << endl;
        else
            cout << 0 << endl;
    }
    
    

}

Measured memory_bytes: 256
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
abc = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while N > 0:
    ans = abc[N % 26 - 1] + ans
    N = (N - ((N - 1) % 26) - 1) // 26
print(ans)

Measured memory_bytes: 9204
using System;
using System.Collections.Generic;


class ExceptionHandling
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var temp = new int[N];
        var sortedArray = new int[N];

        for(var i = 0; i < N; i++)
        {
            temp[i] = int.Parse(Console.ReadLine());
            sortedArray[i] = temp[i];
        }

        Array.Sort(sortedArray);

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

            if (temp[i] < sortedArray[N - 1])
            {
                Console.WriteLine(sortedArray[N - 1]);
            }
            else if (temp[i] == sortedArray[N-1])
            {
                if (temp[i] == 1)
                {
                    Console.WriteLine(1);
                    continue;
                }
                Console.WriteLine(sortedArray[N - 2]);
            }
        }
    }

}


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

namespace AtCoder
{
    class Program
    {
        
        static void Main()
        {
            //ここから
            string str = ReadLineToString();
            string[] ans = new string[3];
            for(int i = 0; i < 3; i++)
            {
                string c = str.Substring(i, 1);
                if (c == "1")
                {
                    ans[i] = "9";
                }else if (c == "9")
                {
                    ans[i]="1";
                }
                else
                {
                    ans[i] =c;
                }
            }

            //ここまで
            Console.WriteLine(ans[0]+ans[1]+ans[2]);
            Console.ReadKey();
        }

        long mod = 1000000007;
        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }
        static public int Conbin(int n,int m) { return Factorial(n) / (Factorial(n - m) * Factorial(m)); }


        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;

int main(){
  int n;
  cin >> n;
  priority_queue<tuple<long, long, long>>Q;
  for(int i=0; i<n; i++){
    long a, b;
    cin >> a >> b;
    Q.push(make_tuple(a+b, a, b));
  }
  int cnt=0;
  long ret=0;
  while(!Q.empty()){
    tuple<long, long, long>t=Q.top();
    Q.pop();
    if(cnt%2==0)ret+=get<1>(t);
    else ret-=get<2>(t);
    cnt++;
  }
  cout << ret;
  return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll x; cin>>x;
  if(x>=30) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	int n;
	cin >> n;
	map<int, bool> dp;
	int c = 0;
	for (size_t i = 0; i < n; i++) {
		int a;
		cin >> a;
		dp[a] = !dp[a];
		if (dp[a]) {
			c++;
		} else {
			c--;
		}
	}
	cout << c << endl;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
#define I_O		ios::sync_with_stdio(false),cin.tie(0)
#define ll		long long
#define ff		first
#define ss		second
#define mod 		1000000007
#define rep(i,n)	for(ll i=1;i<=n;i++)
#define repv(i,a,n)	for(ll i=a;i<=n;i++)
#define pb 		push_back
#define newl		'\n'
#define deb(x)		cout<<x<<" "
int main() 
{  
	I_O;
	int x,y,legs,tot,num;
	cin>>x>>y;
	if(y<=x || y%2)	return cout<<"No",0;
	if(x == 1)
	{
		if(y == 2 || y == 4)	return cout<<"Yes",0;
		else					return cout<<"No",0;
	}
	repv(i,0,x)
	{
		num = x - i;
		legs = (2*i) + (4*num);
		if(legs == y)	return cout<<"Yes",0;
	}
	cout<<"No";
} 


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

using namespace std;

int N, M, Q;
int color[100001];
vector<int> G[100001];
int v[100001],d[100001],c[100001];
int dp[100001];

void solve(int v,int d,int c) {
  if(dp[v] >= d) return;

  if(color[v] == 0) color[v] = c;

  dp[v] = d;

  for(int i = 0; i < G[v].size(); i++) {
    int u = G[v][i];
    solve(u,d-1,c);
  }
  
}


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

  for(int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  cin >> Q;

  for(int i = 0; i < Q; i++) {
    int vv,dd,cc;
    cin >> vv >> dd >> cc;
    vv--;
    v[i] = vv;
    d[i] = dd;
    c[i] = cc;
  }

  for(int i = Q-1; i >= 0; i--) {
    solve(v[i],d[i]+1,c[i]);
  }


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


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


int main(){
  ll n;
  cin >> n;
  vector<ll> l(n);
  ll ans = 0;
  rep(i,n) cin >> l.at(i);
  sort(l.begin(),l.end());
  for(ll i=0;i<n-2;++i){
    for(ll j=i+1;j<n-1;++j){
      for(ll k=j+1;k<n;++k){
        if( l.at(i) + l.at(j) <= l.at(k) ) break;
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <sstream>

using namespace std;

int main() {

  string buf;
  
  string str;

  map<string,int> word;
  string max_frequent_str;
  string max_letters_str;
  int max_frequent;
  int max_letters;

  
  max_letters=0;

  while(cin >> str) {
    
    if(str.length()>max_letters) max_letters=str.length();

    word[str]++;

  }
  
  max_frequent=0;

  for(map<string,int>::iterator it=word.begin();it!=word.end();it++) {

    if(max_frequent<(*it).second) {

      max_frequent=(*it).second;
      max_frequent_str=(*it).first;

    }

    if((*it).first.length()==max_letters) max_letters_str=(*it).first;

  }

  cout << max_frequent_str << " " << max_letters_str << endl;

  return 0;

}

 

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    string S;
    cin >> S;
    if ( S.at(0) == 'S' ) printf("Cloudy\n");
    else if (S.at(0) == 'C') printf("Rainy\n");
    else printf("Sunny\n");
    return 0;
}


Measured memory_bytes: 256
import itertools
N = int(input())
points = []
for _ in range(N):
    x, y = map(int, input().split())
    points.append((x, y))
P = list(itertools.permutations(list(range(N))))
ans = 0
for p in P:
    for i in range(N-1):
        x0, y0 = points[p[i]]
        x1, y1 = points[p[i+1]]
        ans+=((x1-x0)**2+(y1-y0)**2)**(1/2)
print(ans/len(P))





Measured memory_bytes: 48108
/**
  *    █████╗  ██████╗       ██████╗ ██╗     ███████╗
  *   ██╔══██╗██╔════╝       ██╔══██╗██║     ╚══███╔╝
  *   ███████║██║            ██████╔╝██║       ███╔╝
  *   ██╔══██║██║            ██╔═══╝ ██║      ███╔╝
  *   ██║  ██║╚██████╗▄█╗    ██║     ███████╗███████╗
  *   ╚═╝  ╚═╝ ╚═════╝╚═╝    ╚═╝     ╚══════╝╚══════╝
  *
  *  @Author: TieWay59
  *  @Created: 2020/2/5 17:24
  *  @Link: https://onlinejudge.u-aizu.ac.jp/beta/room.html#ICPCOOC2019/problems/A
  *  @Tags:
  *
  *******************************************************/

#include <bits/stdc++.h>

#ifdef DEBUG

#   include "libs59/debugers.h"
//  #define debug(x)  cerr <<#x << " = "<<x<<endl;
#else
#   define endl '\n'
#   define debug(...)
#endif

#define STOPSYNC ios::sync_with_stdio(false);cin.tie(nullptr)
#define MULTIKASE int Kase=0;cin>>Kase;for(int kase=1;kase<=Kase;kase++)
typedef long long ll;
const int MAXN = 2e5 + 59;
const int MOD = 1e9 + 7;
const int INF = 0x3F3F3F3F;
const ll llINF = 0x3F3F3F3F3F3F3F3F;
using namespace std;

ll fpow(ll a, ll b, ll mod = MOD) {
    ll ret = 1;
    while (b) {
        if (b & 1)ret = ret * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ret;
}

void solve(int kaseId = -1) {
    ll t;
    cin >> t;

    if (t < 4) {
        cout << t << endl;
        return;
    }

    ll times = 3;
    ll sum = 4;
    ll ans = 2;

    while (sum + times * 3 + times <= t) {
        sum += times * 3 + times;
        times *= 3;
        ans += 2;
    }

    ll rest = t - sum;

    while (rest > 0 && times > 0) {
        ans += rest / times;
        rest %= times;
        times /= 3;
    }
    cout << ans << endl;
}

void solves() {
    MULTIKASE {
        solve(kase);
    }
}

int main() {
    STOPSYNC;
    solve();
    return 0;
}
/*

 */


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int a,ans=0;
  cin >> a;
  int b[a];
  for(int i = 0;i<a;i++) cin >> b[i];
  int mbg = b[0];
  for(int i=0 ;i<a;i++){
    mbg = __gcd(mbg,b[i]);
  }
  while(mbg%2==0){
    mbg /= 2;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int n, k;
string s;
int l = 0, r = 0;

int32_t main()
{
	IOS;
	cin >> n >> k >> s;
	vector<int> v;
	int ans = 0;
	int cnt = 0;
	for(int i = 0; i + 1 < n; i++)
		ans += (s[i] == s[i + 1]);
	for(int i = 0; i < n;)
	{
		int j = i + 1;
		while(j < n && s[j] == s[i])
			j++;
		cnt++;
		i = j;
	}
	while(cnt > 2 && k > 0)
	{
		cnt -= 2;
		k--;
		ans += 2;
	}
	while(cnt > 1 && k > 0)
	{
		cnt--;
		k--;
		ans++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;


int32_t main()
{
    int n, m;
    cin >> n >> m;

    if(abs(n - m) > 1) {
        cout << 0;
        return 0;
    }
    int x = 1, y = 1;
    int a = n, b = m;
    while(a > 0) {
        x = (x * a)% MOD;
        --a;
    }
    while(b > 0) {
        y = (y * b)% MOD;
        --b;
    }
    if(abs(n - m) == 1) {
        cout << (x * y) % MOD;
    }
    else if(n == m) {
       cout << (2 * (x * y) ) % MOD;
    }

	return 0;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto &v: a) cin >> v;
    sort(a.begin(), a.end());
    int ans = INT_MAX;
    for (int i = 0, j = k-1; j < n; ++i, ++j) {
        ans = min(ans, a[j] - a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import math

r = 50021
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0
            
while True:
    try:
        n = int(raw_input())
        for i in range(n,r):
            if p[i] == 1:
                lp = i+1
                break
        for i in range(n-2,0,-1):
            if p[i] == 1:
                sp = i+1
                break
        print sp, lp
    except:
        break

Measured memory_bytes: 6200
import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))

v=[]
for s in (1,-1):
    x=a[::]
    hugou=[s*(-1)**i for i in range(n)]
    total=0
    for i in range(n):
        if (total+x[i])*hugou[i]<=0:
            x[i]=hugou[i]-total
        total+=x[i]
    v.append(sum(abs(a[i]-x[i]) for i in range(n)))
print(min(v))


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

namespace ConsoleApp2
{
    class Program {
        static void Main(string[] Args) {
            var NQ = new List<String>(ReadLine().Split(' ')).Select(int.Parse).ToList();
            string s = ReadLine();

            List<int> ACList = new List<int>();

            for(int i = 0;i < s.Length - 1; i++) {
                if (s[i] == 'A' && s[i + 1] == 'C')
                    ACList.Add(1);
                else
                    ACList.Add(0);
            }

            List<int> SumList = new List<int>();
            int Sum = 0;
            foreach (var e in ACList) {
                Sum += e;
                SumList.Add(Sum);
            }


            List<int> LRList;
            List<int> res = new List<int>();
            int tmp;

            for (int index = 0; index < NQ[1]; index++) {
                LRList = new List<string>(ReadLine().Split(' ')).Select(int.Parse).ToList();
                tmp = SumList[LRList[1] - 2] - SumList[LRList[0] - 1] + ACList[LRList[0] - 1];
                res.Add(tmp);
            }
            /*
            foreach (var e in ACList)
                Write(e);
            WriteLine();
            foreach (var e in SumList)
                Write(e);
            WriteLine();
            */
            foreach (var e in res)
                WriteLine(e);

            ReadLine();
        }
    }
}


Measured memory_bytes: 19244
#include <stdio.h>

int main(void)
{
    char s1[10], s2[10], s3[10];
    scanf("%s%s%s", s1, s2, s3);

    printf("%c%c%c", s1[0] - 32, s2[0] - 32, s3[0] - 32);

    return (0);
}


Measured memory_bytes: 128
N = int(input())
A = list( map( int, input().split() ) )

x = [0]*N

for i in range(N):
    if i % 2 == 0:
        x[0] += A[i]
    else:
        x[0] -= A[i]

for i in range(1,N):
    x[i] = int( 2 * ( A[i-1] - x[i-1] / 2 ) )

for i in range(N):
    print(str(x[i]), end="")
    if i != N-1:
        print(" ", end="")


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


int main()
{
	long int num;

	cin>>num;
	while(num != 1){
		int ans[100],n=0;
		for(int i=1;(i*7-1)<num;i++){
			if(num%(i*7-1)==0){
				int sosuu=1,temp=i*7-1;
				for(int j=0;j<n;j++){
					if(temp%ans[j]==0) sosuu=0;
				}
				if(sosuu==1){
					ans[n]=temp;
					n++;
				}
			}
			if(num%(i*7+1)==0){
				int sosuu=1,temp=i*7+1;
				for(int j=0;j<n;j++){
					if(temp%ans[j]==0) sosuu=0;
				}
				if(sosuu==1){
					ans[n]=temp;
					n++;
				}
			}
		}
		cout<<num<<":";
		if(n==0) cout<<" "<<num<<endl;
		else{
			for(int i=0;i<n;i++) cout<<" "<<ans[i];
			cout<<endl;
		}
		cin>>num;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int a, b;
    while (cin>>a>>b) {
        int sum = a + b;
        int cnt = 1;
        while (sum /= 10) {
            cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


Measured memory_bytes: 3008
#include<iostream>

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define v(d_type) vector<d_type>
#define loop(i, s, n) for(int i = s; i < n; i++)
#define min(x, y) (x) > (y) ? (y) : (x)
#define max(x, y) (x) < (y) ? (y) : (x)
#define print_vec(X) loop(i, 0, X.size()) cout << X[i] << "\n"
 
int main()
{
  int n, d;
  cin >> n >> d;
  d = 2*d + 1;
  ll inspectors = n / d;

  if(n%d != 0)
    inspectors++;
  cout << inspectors << "\n";
  return 0;
}

Measured memory_bytes: 256
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
//#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    map<ll, int> mp;
    ll S = 0;
    rep(i, 0, N){
        cin >> A.at(i);
        if (mp.count(A.at(i))){
            mp[A.at(i)]++;
        }
        else{
            mp[A.at(i)] = 1;
        }
        S += A.at(i);
    }
    
    int Q;
    cin >> Q;
    rep(i, 0, Q){
        ll B, C;
        cin >> B >> C;
        if(mp.count(B)){
            S += mp[B] * (C - B);
            cout << S << endl;
            if(mp.count(C)){
                mp[C] += mp[B];
            }
            else{
                mp[C] = mp[B];
            }
            mp[B] = 0;
        }
        else{
            cout << S << endl;
        }
    }
}

Measured memory_bytes: 9308
N, Ch = map(int, input().split())
L = [list(map(int, input().split())) for i in range(N)]
L.sort(key=lambda x: x[0])
time = 0
T = [-1]
C = [-1]
ans = 1
for si, ti, ci in L:
    if time < si:
        time = si
        for xt, t in enumerate(T):
            if t == -1:
                continue
            elif t < si:
                T[xt] = -1
                C[xt] = -1
            elif t == si:
                T[xt] = -2

    if -2 in T:
        flg = False
        for index, t in enumerate(T):
            if t != -2:
                continue
            if C[index] == ci:
                T[index] = ti
                flg = True
                break
        if flg:
            continue

    if -1 in T:
        index = T.index(-1)
        T[index] = ti
        C[index] = ci
        continue
    else:
        ans += 1
        T.append(ti)
        C.append(ci)
print(ans)


Measured memory_bytes: 29164
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n,k; cin >> n >> k;
    ll max_a = 1e12 + 10;
    int max_pow = 0;
    ll temp = 1;
    while(temp < max_a){
        temp <<= 1;
        max_pow++;
    }
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    // cout << temp << " " << max_pow << endl;
    ll dp_0[max_pow] = {}, dp_1[max_pow] = {};
    temp = 1;
    int k_max = 0;
    while(temp <= k){
        temp <<= 1;k_max++;
    }
    rep(i,n){
        rep(j,k_max){
            ll atemp = a[i] >> j;
            if(1 & atemp)dp_1[j]++;
            else dp_0[j]++;
        }
    }
    // cout << k_max;
    vector<ll> theory_ans(k_max,0);
    rep(i,k_max){
        if(dp_0[i] <= dp_1[i])theory_ans[i] = 0;
        else theory_ans[i] = 1;
    }
    ll ans= 0;
    rep(i,k_max)ans += theory_ans[i] * pow(2, i);
    // cout << ans << endl;
    ll res;
    auto change = [&](vector<ll> vec){
        ll ret = 0;
        rep(i,k_max)ret += vec[i] * pow(2, i);
        return ret;
    };
    auto f = [&](ll x){
        ll ret = 0;
        rep(i,n){
            ret += (x ^ a[i]);
        }
        return ret;
    };

    if(ans <= k){
        res = ans;
        cout << f(res) << endl;
        return 0;
    }
    // int k_bit[k_max];
    // rep(i,k_max){
    //     if((k >> i) & 1)k_bit[i] = 1;
    //     else k_bit[i] = 0;
    // }

    // ll ret = 0;
    // for(int i = k_max-1; 0 <= i;i--){
    //     vector<ll> temp = theory_ans;
    //     if(!k_bit[i])continue;
    //     for(int j = k_max-1;i < j;j--)temp[j] = k_bit[j];
    //     temp[i] = 0;
    //     res = change(temp);
    //     // cout << res << endl;
    //     assert(res <= k);
    //     ret = max(ret, f(res));
    // }

    // ret = max(ret,f(k));

    // cout << ret << endl;
    // return 0;

    for(int i = k_max-1;0 <= i;i--){
        ll ktemp = k >> i;
        ll atemp = ans >> i;
        if(ktemp & 1){
            if(atemp & 1)continue;
            else break;
        }
        else{
            if(atemp & 1)ans -= pow(2, i);
            else continue;
        }
    }

    assert(ans <= k);

    cout << f(ans) << endl;
    
}

Measured memory_bytes: 1024
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;
void FastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
}

const int N = 1e6;

int main()
{
  FastIO();
  int tc, ca = 0;
  string s, t;
  cin >> s >> t;
  t.erase(t.begin()+t.size()-1);
  if (s==t)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


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

int main(){
  int n; cin >>n;
  ll ans = 0;
  for(int i = 1; i<=n; i++){
    for(int j = i; j<=n; j+=i) ans += j;
  }
  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 3652
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


s = S()
k = I()
L = []
cnt = 0
ret = 1
if len(s) == 1:
    print(k // 2)
else:
    for j in range(len(s) - 1):
        if s[j] != s[0]:
            break

    for l in range(len(s) - 1):
        if s[-1] != s[-1 - l]:
            break


    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            ret += 1
        else:
            if ret > 1:
                cnt += ret // 2
            ret = 1


    cnt += ret // 2


    ans = cnt * k
    if len(set(s)) == 1 and k % 2:
        ans = k * len(s) // 2
    elif s[0] == s[-1] and j % 2 and l % 2:
        ans += k - 1
    print(ans)

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

const int N = 1e5 + 10;
int deg[N], a[N], n;

bool vis[N];
vector<int> c;

void dfs(int nw, int lst) {
    if (nw >= n) {
        for (auto v : c) cout << v << " ";
        cout << '\n';
        exit(0);
    }
    if (c.size()) {
        int u = a[c.back()];
        if (!vis[u] && nw + deg[u] + 1 == n) return;
    }
    while (lst <= n && vis[lst]) ++lst;
    for (int i = lst; i <= n; ++i) if (!vis[i]) {
        if (nw && i == a[c[nw - 1]]) continue;
        vis[i] = 1;
        c.push_back(i);
        --deg[a[i]];
        dfs(nw + 1, lst);
        vis[i] = 0;
        c.pop_back();
        ++deg[a[i]];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        ++deg[a[i]];
    }
    dfs(0, 1);
    cout << "-1\n";
    return 0;
}

Measured memory_bytes: 14056
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    int N,W;
    cin>>N>>W;
    vector<int> v(N),w(N);
    for(int i=0;i<N;i++)cin>>v[i]>>w[i];
    vector<vector<int> > dp(2,vector<int>(W+1,0) );
    for(int i=0;i<N;i++){
	for(int j=0;j<=W;j++){
	    if( w[i] <= j){
		dp[(i+1)%2][j] = max( dp[i%2][j] ,dp[(i+1)%2][j-w[i]] + v[i] );
	    }else{
		dp[(i+1)%2][j] = dp[ i%2 ][j];
	    }
	}
    }
    cout<<dp[N%2][W]<<endl;
    return 0;
}



Measured memory_bytes: 3280
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    vector<vector<int> > memo(H, vector<int>(W, -1));
    for(int h=0; h<H; h++) {
        cin >> field[h];
        if(h==0) {
            if(field[h][0]=='.') {
                memo[h][0] = 0;
            } else {
                memo[h][0] = 1;
            }
            for(int w=1; w<W; w++) {
                memo[h][w] = memo[h][w-1];
                if(field[h][w-1]=='.' && field[h][w]=='#') {
                    memo[h][w]++;
                }
            }
        } else {
            memo[h][0] = memo[h-1][0];
            if(field[h-1][0]=='.' && field[h][0]=='#') {
                memo[h][0]++;
            }
            for(int w=1; w<W; w++) {
                int u=memo[h-1][w], l=memo[h][w-1];
                if(field[h-1][w]=='.' && field[h][w]=='#') {
                    u++;
                }
                if(field[h][w-1]=='.' && field[h][w]=='#') {
                    l++;
                }
                memo[h][w] = min(u, l);
            }
        }
    }
    cout << memo[H-1][W-1] << endl;




    return 0;
    
}

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

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

	vector<int> v;
	int a;
	rep(i, n) {
		cin >> a;
		v.push_back(a);
	}

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

	cout << ((v.size() == n) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 1400
def solve(n):
    for x in range(n/4+1):
        for y in range(n/7+1):
            if 4*x + 7*y == n:
                return "Yes"
    return "No"

assert solve(11) == "Yes"
assert solve(40) == "Yes"
assert solve(3) == "No"
print solve(input())

Measured memory_bytes: 2568
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	day := scanner.Text()
	fmt.Println(7 - dayToInt(day))
}

func dayToInt(day string) int {
	switch day {
	case "SUN":
		return 0
	case "MON":
		return 1
	case "TUE":
		return 2
	case "WED":
		return 3
	case "THU":
		return 4
	case "FRI":
		return 5
	case "SAT":
		return 6
	default:
		panic("unknown day")
	}
}


Measured memory_bytes: 640
def solve():
    R, G, B, N = [int(_) for _ in raw_input().split()]
    X = min(R, G, B)
    if X == R:
        Y = min(G,B)
        Z = max(G,B)
    elif X == G:
        Y = min(R,B)
        Z = max(R,B)
    else:
        Y = min(R,G)
        Z = max(R,G)
    ret = 0
    for i in range(N/Z, -1, -1):
        for j in range((N - i * Z)/Y, -1, -1):
            sum2 = N - i * Z - j * Y
            if sum2 % X == 0:
                ret += 1
    print str(ret)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 30188
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <unordered_map>
#include <string>
#include <functional>
#include <numeric>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template<typename T>
#define _HT template<typename H,typename... T>
_T _DEF(T,in,int c){T n{};int m{1};while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c{gcu()};return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, int &c){c=gcu();gcu();return c!=EOF;}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p{b};T m=n<0?pcu('-'),-1:1;if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{int e,b{0},s{1};range(int _b,int _e,int _s):e(_e),b(_b),s(_s){}range(int _b,int _e):e(_e),b(_b){}range(int _e):e(_e){}
	struct it{int v,s;it(int _v,int _s):v(_v),s(_s){}operator int()const{return v;}operator int&(){return v;}int operator*()const{return v;}it& operator++(){v+=s;return *this;}};
	it begin(){return{b, s};}it end(){return{e,s};}};

struct item {
	int p;
	vector<int> c;
};

int main() {
	string s;
	for (int n; (n = in());) {
		unordered_map<string, int> t;
		vector<item> r(n);
		for (int i: range(n)) {
			scan(s);
			t[s] = i;
			r[i].p = in();
		}
		for (int m {in()}; m; m--) {
			scan(s);
			auto &o {r[t[s]].c};
			for (int i {in()}; i; i--) {
				scan(s);
				o.push_back(t[s]);
			}
		}
		function<int(int)> mc{[&](int i) {
			item &o {r[i]};
			return o.c.size() ?
				min(o.p, accumulate(begin(o.c), end(o.c), 0,
									[&](int a, int j){return a + mc(j);})) :
				o.p;
		}};
		scan(s);
		outl(mc(t[s]));
	}
}


Measured memory_bytes: 2672
/*ex3_3
    takafumi_ueki*/
#include <stdio.h>
int main(void){
    //x(:ある整数)がn進法で表したときa桁になる
    int x,n;
    int a = 0;
    //xが0になるまで引き続け、その引いた回数が桁数になる
    scanf("%d %d",&x,&n);
    while(x != 0){
        x = x/n;
        a++;
    }
printf("%d\n",a);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

typedef long long LL;
typedef vector<LL> VL;
typedef vector<vector<LL>> VVL;
typedef vector<string> VS;

#define REPD(i,a,b) for (LL i=(a);i<(b);i++)
#define REP(i,n) REPD(i,0,n)

LL llRead(){
  LL a;
  cin >> a;
  return a;
};

string stringRead(){
  string a;
  cin >> a;
  return a;
};

vector<LL> vlRead(LL a){
  vector<LL> rv;
  REP(i, a){
    LL input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}

vector<string> vsRead(LL a){
  vector<string> rv;
  REP(i, a){
    string input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}
vector<vector<LL>> vvlRead(LL a, LL b){
  vector<vector<LL>> rv;
  REP(i, a){
    rv.push_back(vector<LL>());
    REP(j, b) {
      LL input;
      cin >> input;
      rv.at(i).push_back(input);
    }
  }
  return rv;
}

#if 1
#define debug(d) debug1(__LINE__,#d, d)
void debug1(LL line, const char* name, VL& v) {
  cout << line << ":" << name << ":vector<LL>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, LL i) {
  cout << line << ":" << name << ":LL " << i << endl;;
}
void debug1(LL line, const char* name, VS& v) {
  cout << line << ":" << name << ":vector<string>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, VVL& v) {
  cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    REP(j, (LL)v.at(i).size()) {
      cout << v.at(i).at(j) << " ";
    }
    cout << ", ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, char* s) {
  cout << line << ":" << name << ":char* " << s << endl;;
}
void debug1(LL line, const char* name, vector<const char*>& v) {
  cout << line << ":" << name << ":vector<const char*>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, priority_queue<LL>& p) {
  cout << line << ":" << name << ":priority_queue<LL>(" << p.size() << ") ";
  priority_queue<LL> copy = p;
  while(!copy.empty()) {
    cout << copy.top() << " ";
    copy.pop();
  }
  cout << endl;
}
void debug1(LL line, const char* name, vector<pair<LL,LL>>& v) {
  cout << line << ":" << name << ":vector<pair<LL,LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i).first << "," << v.at(i).second << " ";
  }
  cout << endl;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
	cout.precision(16);
  // source code

  auto n = llRead();
  cout << n*n << endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    int N, M;
    cin >> N >> M;
    vector<int> array(N);
    ll sum = 0;
    rep(i, N){
        int num;
        cin >> num;
        array[i] = num;
        sum += num;
    }
    int ans = 0;
    rep(i, N){
        if(array[i] >= sum / (4.0 * M)) ans++;
    }
    if(ans >= M)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  int x = 0;
  cin >> A >> B;
  for (int i = 0; A <= B; i++) {
    if (A % 10 == A / 10000  &&  A % 100 / 10 == A % 10000/ 1000) {x++;}
    A++;}
  cout << x << endl;
}

Measured memory_bytes: 3572
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>
#include <bitset>
#include <time.h>
#include <stdio.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mpa make_pair
#define all(a) a.begin(), a.end()

template<typename T>
void vdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		if (i == size - 1) {
			cout << da[i] << endl;
		}
		else {
			cout << da[i] << ' ';
		}
	}
}
template<typename T>
void vvdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		vdeb(da[i]);
	}
}

struct UnionFind{
    int size;
    vector<int> par;
    vector<int> rank;
    UnionFind(int x){
        size=x;
        par=vector<int> (x);
        rank=vector<int> (x,1);
        for (int i=0;i<x;i++){
            par[i]=i;
        }
    }
    int root(int x){
        if(par[x]==x){
            return x;
        }
        else{
            return par[x]=root(par[x]);
        }
    }
    void unite(int x,int y){
        x=root(x);y=root(y);
        if(x==y){
            return;
        }
        if(rank[x]<rank[y]){
            par[x]=y;
        }
        else{
            par[y]=x;
        }
        if(rank[x]==rank[y]){
            rank[x]++;
        }
    }
    bool check(int x,int y){
        return root(x)==root(y);
    }
    void initialize(){
        for (int i=0;i<size;i++){
            par[i]=i;
            rank[i]=1;
        }
    }
	void all_gather(map<int,vector<int>> &mp){
		rip(i,size,0){
			if(mp.count(root(i))){
				mp[root(i)].push_back(i);
			}
			else{
				mp[root(i)] = vector<int>(1,i);
			}
		}
	}
};

ll counter(vector<P> &da, vector<int> &li){
	ll ret = 0;
	set<int> x, y;
	rip(i,li.size(),0){
		x.insert(da[li[i]].first);
		y.insert(da[li[i]].second);
	}
	return (ll) x.size() *y.size() - li.size();
}

int main(){
	int n; cin >> n;
	vector<P> da(n);
	map<int,int> mpx, mpy;
	UnionFind uf(n);
	rip(i,n,0){
		cin >> da[i].first >> da[i].second;
		if(mpx.count(da[i].first)) uf.unite(i, mpx[da[i].first]); else mpx[da[i].first] = i;
		if(mpy.count(da[i].second)) uf.unite(i, mpy[da[i].second]); else mpy[da[i].second] = i;
	}
	map<int, vector<int>> mp;
	uf.all_gather(mp);
	ll ans = 0;
	for(auto i:mp){
		//cout << i.first << endl;
		ans += counter(da, i.second);
	}
	cout << ans << endl;
}

Measured memory_bytes: 11896
#include <bits/stdc++.h>
using namespace std;
main () {
	int n; cin >> n;
	string s; cin >> s;
	int cnta = 0, cntb = 0;
	int ans = n;
	for(auto it: s) cntb += it == '.';
	for(int i = 0; i <= n; i ++) {
		ans = min({ans, cnta + cntb});
		if(s[i] == '.') cntb --;
		else            cnta ++;
	}
	cout << ans;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  ll n, t;
  cin >> n >> t;
  vector<ll> v;
  REP(i, n) {
    ll a, b;
    cin >> a >> b;

    if (b <= t) {
      v.pb(a);
    }
  }
  if (v.size() == 0) {
    cout << "TLE" << endl;
    return 0;
  }
  sort(v.begin(), v.end());

  cout << v[0] << endl;
}

Measured memory_bytes: 256