akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int x;
	cin >> x;

	for(int i0=0;i0<=x/100;i0++){
		for(int i1=0;i1<=x/100;i1++){
			for(int i2=0;i2<=x/100;i2++){
				for(int i3=0;i3<=x/100;i3++){
					for(int i4=0;i4<=x/100;i4++){
						for(int i5=0;i5<=x/100;i5++){
							if(100*i0+101*i1+102*i2+103*i3+104*i4+105*i5>x) break;
							if(100*i0+101*i1+102*i2+103*i3+104*i4+105*i5==x){
								cout << 1 << endl;
								return 0;
							}
						}
					}
				}
			}
		}
	}
	cout << 0 << endl;
}

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

using namespace std; 

int main(){ 
  int n;
  cin>>n;
  int64_t ans=1;
  for(int i=1;i<n+1;++i){
    ans*=i;
    ans%=1000000007;
  }
  cout<<ans;
 
 

} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<string> vs;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<pair<string, ll> > vsi;
typedef set<ll> si;
typedef map<ll, ll> mii;
typedef map<string, ll> msi;
typedef tuple<ll, ll, ll> ti;
 
 
vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}
 
#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
 
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
 
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}
 
 
#define pb push_back
#define mk make_pair
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define mod 1000000007
#define ff first
#define ss second
 
 
//Loops
#define REP(i, b) for(ll i=0; i<(ll)(b); i++)
#define F(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define FD(i, a, b) for(ll i=(ll)(a); i>=(ll)(b); i--)
 
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define RTIME(start, end) ((double)(end-start)/(double)CLOCKS_PER_SEC)
#define D(a) cout<<a<<endl
#define MAX 1000007
//#define INF 1e18
 
const ll nmax=1000*1007;
    

struct edge
{
    ll a, b, cost;
    edge(ll x, ll y, ll z):a(x), b(y), cost(z) {};
};
 
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);   
 
}
 

int main ()
{
    fastio()
 
    ll x;
    string s;
    cin>>x>>s;

    if(x < 3200)    cout<<"red\n";
    else    cout<<s<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>
#include <numeric>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007
#define SQ(x) ((x)*(x))

int main() {
	LL k;
	cin >> k;
	int n = 50;
	VLL ret(n);
	LL x = (k + 49) / 50 - 1;
	LL t = ((k + 49) / 50) * 50;
	REP(i, n) ret[i] = 50 + x - i;
	int loop = ((k + 49) / 50) * 50 - k;
	REP(i, loop) {
		REP(j, n) {
			ret[j]++;
		}
		ret[i] -= 51;
	}
	printf("%d\n", n);
	REP(i, n)printf("%lld ", ret[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<vector>
#include<cstdio>
#include<climits>
#include<cfloat>
#include<cstring>
#define foreach(t,p,it) for(t::iterator it=p.begin(),it!=p.end(),++it)
#define all(p) p.begin(),p.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
using namespace std;

#define MAXN 10000010

char prime[MAXN];
vector<int> prime4;

int main()
{
    prime[0] = 1;
    prime[1] = 1;
    for(int i=2;i<MAXN;i++) if(!prime[i])
        for(int j=2*i;j<MAXN;j+=i) prime[j] = 1;

    REP(MAXN-8)
    {
        if((!prime[i])&&(!prime[i+2])&&(!prime[i+6])&&(!prime[i+8]))prime4.push_back(i+8);
    }
    
    int n;
    int prime4num = prime4.size();
    //cout << prime4num << endl;
    while(cin>>n && n)
    {
        int ans = 0;
        REP(prime4num)
        {
            if(prime4[i]>n) break;
            if(ans<prime4[i]) ans = prime4[i];
        }
        cout << ans << endl;
    }
    

    return 0;
}

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

long long N;

int main(){
	cin >> N;
	long long odd = 0;
	long long even = 0;
	for(long long i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		if(tmp % 2 == 0){
			even++;
		}else{
			odd++;
		}
	}
	if(odd%2 != 0){
		cout << "NO" << endl;
	}else{
		cout << "YES" << endl;
	}
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for i in range(N)]
B = [ [0] * 2 for i in range(N)]

for i in range(N):
    B[i][0] = A[i]
    B[i][1] = i

B.sort(reverse=True)
for i in range(N):
    if B[0][1] == i:
        print(B[1][0])
    else:
        print(B[0][0])


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

int main(){
    while(true){
        int x,y;
        cin >> x >> y;
        if (x==0 && y==0)break;
        else if (x<y){
            cout << x << " " << y << endl;
        }
        else{
            cout << y << " " << x << endl;
        }
    }
    
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int i=0,j,c=0,p,h[1000010],n,max;
    string s;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> h[i];
    }
    max=h[0];
    for(i=1;i<n;i++)
    {
        if(h[i]>=max)
        {
            c++;
            max=h[i];
        }
        
    }
    cout << c+1 << endl;
    return 0;

}


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

int main(){
  long long a,K,A,B,c,now;
  cin>>K>>A>>B;
  a=K;
  now=1;
  for(int i=0;i<min(K,A-1);i++){
    now++;
    a--;
  }
  c=B-A;
  if(c<=2){
    cout<<K+1<<endl;
  return 0;
  }
  else{
    cout<<now+c*(a/2)+a%2<<endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PGC
{
	class Program
	{
		static void Main(string[] args)
		{
			var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var N = NK[0];
			var K = NK[1];

			var RPS = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var scoreMap = new Dictionary<char, int>();
			var R = RPS[0];
			var S = RPS[1];
			var P = RPS[2];
			scoreMap.Add('r', R);
			scoreMap.Add('s', S);
			scoreMap.Add('p', P);
			scoreMap.Add('a', 0);

			var T = Console.ReadLine().ToCharArray();

			var ANS = new char[T.Length];
			for (var i = 0; i < K; i++)
			{
				ANS[i] = Win(T[i]);
			}

			for (var i = K; i < N; i++)
			{
				var tmp = Win(T[i]);
				if (tmp == ANS[i - K])
				{
					tmp = 'a';
				}
				ANS[i] = tmp;
			}

			var score = 0;
			for (var i = 0; i < N; i++)
			{
				var w = Win(T[i]);
				if (ANS[i] == w)
				{
					score += scoreMap[w];
				}
			}

			System.Console.WriteLine(score);
		}
		static char Win(char c)
		{
			var ret = 'a';
			switch (c)
			{
				case 'r':
					ret = 'p';
					break;
				case 's':
					ret = 'r';
					break;
				case 'p':
					ret = 's';
					break;
			}

			return ret;
		}
	}

}


Measured memory_bytes: 14048
#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << '\n'

using ll = long long;
using namespace std;

const int N = 3010;
char s[N], t[N];
int dp[N][N], n, m;
string ans;

int solve(int i, int j)
{
	if (i > n || j > m)
		return 0;
	if (dp[i][j] != -1)
		return dp[i][j];
	dp[i][j] = solve(i + 1, j + 1) + (s[i - 1] == t[j - 1]);
	dp[i][j] = max(dp[i][j], solve(i + 1, j));
	dp[i][j] = max(dp[i][j], solve(i, j + 1));
	return dp[i][j];
}

void build(int i, int j)
{
	if (i > n || j > m)
		return;
	int a = dp[i + 1][j + 1] + (s[i - 1] == t[j - 1]);
	int b = dp[i + 1][j];
	int c = dp[i][j + 1];
	if (a >= b && a >= c)
	{
		if (s[i - 1] == t[j - 1])
			ans += s[i - 1];
		build(i + 1, j + 1);
	}
	else if (b >= a && b >= c)
	{
		build(i + 1, j);
	}
	else
	{
		build(i, j + 1);
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

#ifdef LOCAL_DEFINE
	freopen("in.txt", "r", stdin);
#endif

	cin >> s >> t;
	n = strlen(s), m = strlen(t);
	memset(dp, -1, sizeof(dp));
	solve(1, 1);
	build(1, 1);

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 35840
# time complexity: O(N + M)
# space complexity: O(N)

import sys
sys.setrecursionlimit(100000)
fin = sys.stdin.readline

N, M = [int(elem) for elem in fin().split()]
adj = [[] for _ in range(N)]
for _ in range(M):
    a, b = [int(elem) - 1 for elem in fin().split()]
    adj[a].append(b)
    adj[b].append(a)


def judge_bipartite(adj, v, color, colors):
    colors[v] = color
    for neighbor in adj[v]:
        if colors[neighbor] is None:
            if not judge_bipartite(adj, neighbor, 1 - color, colors):
                return False
        else:
            if colors[neighbor] == color:
                return False
    else:
        return True

colors = [None] * N
bipartite = judge_bipartite(adj, 0, 0, colors)

if not bipartite:
    print(N * (N - 1) // 2 - M)
else:
    num_b = sum([v == 0 for v in colors])
    num_w = N - num_b
    print(num_b * num_w - M)




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

int main(){
  const int Nw= 4;
  vector<vector<int>> data(Nw);
  int N,vi; int64_t W,w0,wi;
  cin >> N >> W;
  cin >> w0 >> vi;
  data.at(0).emplace_back(vi);

  for(int i=1; i<N; i++){
    cin >> wi >> vi;
    data.at(wi-w0).emplace_back(vi);
  }

  vector<vector<int>> cumsum(Nw);
  for(int i=0; i<Nw; i++){
    sort(data.at(i).begin(), data.at(i).end(), greater<int>());

    int sum= 0;
    cumsum.at(i).emplace_back(sum);
    for(int j=0; j<data.at(i).size(); j++){
      sum+= data.at(i).at(j);
      cumsum.at(i).emplace_back(sum);
    }
  }
  
  int ans= -1;
  for(int n0=0; n0<cumsum.at(0).size(); n0++){
    for(int n1=0; n1<cumsum.at(1).size(); n1++){
      for(int n2=0; n2<cumsum.at(2).size(); n2++){
        for(int n3=0; n3<cumsum.at(3).size(); n3++){
          int64_t w= w0*(n0+n1+n2+n3)+ n1+ 2*n2+ 3*n3;
          if(w <= W){
            ans= max(ans, cumsum.at(0).at(n0)+ cumsum.at(1).at(n1)+ cumsum.at(2).at(n2)+ cumsum.at(3).at(n3));
          }
        }
      }
    }
  }
  
  cout << ans << endl;
}

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

using namespace std;

long long n;
set<long long> s, fact;

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

    for(long long i = 2; i * i <= n; i++){
        if(n % i) continue;

        long long x = n;

        while(x % i == 0) x /= i;
        if(x % i == 1) s.insert(i);

        fact.insert(i);
        if(i * i == n) break;

        x = n;
        while(x % (n / i) == 0) x /= (n / i);
        if(x % (n / i) == 1) s.insert(n / i);

        fact.insert(n / i);
    }

    s.insert(n);
    fact.insert(1), fact.insert(n);

    --n;

    for(long long i = 1; i * i <= n; i++){
        if(n % i) continue;

        if(!fact.count(i)) s.insert(i);

        if(i * i == n) break;

        if(!fact.count(n / i)) s.insert(n / i);
    }

    printf("%d\n", (int) s.size());
    
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        //xの値を代入する
        int x = sc.nextInt();
        
        //xの3乗の値を表示する
        System.out.println(x * x *x);
    }
}



Measured memory_bytes: 26148
#include<iostream>
#include<string>

using namespace std;


//the this that を探す
bool found(string s){
	if ((s.find("the") != -1) || (s.find("this") != -1) || (s.find("that") != -1))
		return true;
	else
		return false;
}


int main(){

	string str;
	while (getline(cin, str)){

		string ans = str;

		int j = 0;

		while (!found(ans)){
			j++;
			for (int i = 0; i < str.size(); i++){
				if
					(ans[i] == ' ') ans[i] = ans[i];
				else if
					(ans[i] == '.') ans[i] = ans[i];
				else
					ans[i] = ((int)str[i] + j)>(int)'z' ? (char)((int)str[i] + j - 26) : (char)((int)str[i] + j);
			}
			if (found(ans)) break;
		}

		cout << ans << endl;
	}

	return 0;

}

Measured memory_bytes: 1184
n,x=map(int,input().split())

atusa=[1]
Pkosu=[1]
for i in range(n):
  atusa.append(atusa[-1]*2+3)
  Pkosu.append(Pkosu[-1]*2+1)

def getPkosu(level,num):
  #print(level,num)
  if level==0 and num==0:
    return 0
  elif level==0 and num==1:
    return 1
  elif num==1 or num==0:
    return 0
  elif num <= atusa[level-1]+1:
    return getPkosu(level-1,num-1)
  elif num == atusa[level-1]+2:
    return Pkosu[level-1]+1
  elif num <= atusa[level-1]*2+2:
    return Pkosu[level-1]+getPkosu(level-1,num-(2+atusa[level-1]))+1
  else:
    return Pkosu[level-1]*2+1

print(getPkosu(n,x))
#print(atusa)
#print(Pkosu)


Measured memory_bytes: 3064
M,D = map(int, input().split())

D = int(D)
ans = 0

for i in range(1,M+1):
    for j in range(1,D+1):
        j = str(j)
        if len(j) == 2:
            j1 = int(j[0])
            j2 = int(j[1])
            if j1 >= 2 and j2 >= 2 and j1 * j2 == i:
                ans += 1


print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    ll a;
    cin>>a;
    string s;
    cin>>s;
   int b =  (s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
 
 
 
    ll ans = a*b;
 
    ans = ans/100;
    
 
    cout<<ans<<endl;
 
 
 
}

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

using namespace std;

int main()
{  int k,s,count=0;
  cin>>k>>s;
    for(int x=0;x<=k;x++)
    {
        for(int y=0;y<=k;y++)
        {
            int z=s-x-y;
            if(z<=k&&z>=0)
            {
                count++;
            }
        }
    }
     cout<<count<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,sum=0;
  cin >> n;
  for(int i=1;i<=n;i++){
  	sum+=i;
  	if(sum>=n){
  		cout << i << endl;
  		return 0;
  	}
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+50; 
typedef long long ll;
struct P{int zo,oe,tag;}tp;
bool operator <(const P&a,const P&b)
{return 1ll*a.zo*b.oe<1ll*a.oe*b.zo;}
int n,a[N],b[N],f[N],F[N];
priority_queue<P>Q;

ll ans;

inline int getfa(int x){return x==F[x]?x:F[x]=getfa(F[x]);}

int main(){
	int i,j,ix,iy;
    scanf("%d",&n);
    F[1]=1;
	for(i=2;i<=n;++i) scanf("%d",&f[i]),F[i]=i;
    F[0]=0;
    for(i=1;i<=n;++i){
	 scanf("%d",&ix);
	 if(ix==0) a[i]++;else b[i]++;
	}
    for(i=1;i<=n;++i) Q.push((P){a[i],b[i],i});
    for(;!Q.empty();Q.pop()){
    	tp=Q.top();ix=getfa(tp.tag);
    	if((tp.zo!=a[ix])||(tp.oe!=b[ix])) continue;
    	iy=getfa(f[ix]);F[ix]=iy;
    	ans+=1ll*b[iy]*a[ix];
    	a[iy]+=a[ix];b[iy]+=b[ix];
    	if(iy) Q.push((P){a[iy],b[iy],iy});
    }
    printf("%lld\n",ans);
}
 

Measured memory_bytes: 8052
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d,e;
    int minp,minj;
    cin >> a;
     cin >> b;
     cin >> c;
     cin >> d;
     cin >> e;
    if(a<=b && a<=c){minp=a;}
       if(b<=a && b<=c){minp=b;}
       if(c<=a && c<=b){minp=c;}
       if(d<=e){minj=d;}
       if(e<=d){minj=e;}
       
    cout<<minp+minj-50<<endl;

}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int N;
char s[40],a[40],b[40],c[40],d[40];
int cnt,dnt;
ll ans;
ll f[40][40];
void dp() {
    memset(f,0,sizeof f);
    f[0][0]=1;
    for(int i=0;i<=cnt;++i)
        for(int j=0;j<=dnt;++j) if(i+j)
            f[i][j]=f[i-1][j]*(c[i]==b[i+j])+f[i][j-1]*(d[j]==b[i+j]);//,printf("f[%d][%d]=%lld\n",i,j,f[i][j]);
    ans+=f[cnt][dnt];
}
int main() {
    scanf("%d",&N);
    scanf("%s",s+1);
    for(int i=1;i<=N;++i) a[i]=s[i],b[i]=s[N+N+1-i];
    for(int i=0;i<(1<<N);++i) {
        dnt=cnt=0;
        for(int j=0;j<N;++j) {
            if((1<<j)&i) c[++cnt]=a[j+1];
            else    d[++dnt]=a[j+1];
        }
        dp();
    }
    printf("%lld\n",ans);
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> p(N), q(N),temp(N);
    for(int i=0;i<N;i++) cin >> p[i];
    for(int i=0;i<N;i++) cin >> q[i];
    int p_num=0;
    int q_num=0;
    temp=p;
    sort(temp.begin(),temp.end());
    int i=1;
    do{
        if(p_num*q_num) break;
        if(p==temp) p_num = i;
        if(q==temp) q_num = i;
        i++;
    }while(next_permutation(temp.begin(),temp.end()));

    cout << abs(p_num-q_num) << endl;
    return 0;
}

Measured memory_bytes: 3604
def main():
    S = input()
    N = len(S)
    K = int(input())
    from string import ascii_lowercase
    dic = {a: i for i, a in enumerate(ascii_lowercase)}
    rdic = {i: a for i, a in enumerate(ascii_lowercase)}
    li = [(26 - dic[s]) % 26 for s in S]
    ans = []
    # print(li)
    for i, cnt in enumerate(li):
        if i == N - 1:
            ans.append(rdic[(dic[S[i]] + K) % 26])
            continue
        if cnt <= K:
            K -= cnt
            ans.append("a")
        else:
            ans.append(S[i])
    print("".join(ans))


if __name__ == '__main__':
    main()


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

int main(int argc, const char * argv[]) {
    int n;
    int a[2][100];
    cin >> n;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }
    // j番目で下に行ったときの飴の和を全部みる
    int max = 0, val = 0, y = 0;
    for(int j = 0; j < n; j++){
        for(int k = 0; k < n; k++){
            val += a[y][k];
            if(j == k){
                y = 1;
                val += a[y][k];
            }
        }
        if(max < val){
            max = val;
        }
        val = 0;
        y = 0;
    }
    cout << max;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
using namespace std;
const int N=4010,mod=924844033;
int n,k,ans;
int tot,ok[N];
int fac[N]={1},f[N][N][2]={1},g[N];
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		ok[++tot]=0;
		for(int j=i+k;j<=n;j+=k)
			ok[++tot]=1;
		ok[++tot]=0;
		for(int j=i+k;j<=n;j+=k)
			ok[++tot]=1;
	}
	for(int i=1;i<=2*n;i++)
	{
		fac[i]=1ll*fac[i-1]*i%mod;
		f[i][0][0]=(f[i-1][0][0]+f[i-1][0][1])%mod;
		f[i][0][1]=0;
		for(int j=1;j<=n;j++)
		{
			f[i][j][0]=(f[i-1][j][0]+f[i-1][j][1])%mod;
			f[i][j][1]=f[i-1][j-1][0]*ok[i];
		}
	}
	for(int i=0;i<=n;i++)
	{
		g[i]=(f[2*n][i][0]+f[2*n][i][1])%mod;
		if(~i&1)ans=(ans+1ll*g[i]*fac[n-i])%mod;
		else ans=(ans-1ll*g[i]*fac[n-i])%mod;
	}
	ans=(ans+mod)%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 78720
def main():
    s, = open(0).read().split()
    n = len(s)

    cnt = [0] * n
    stock_r_odd = 0
    stock_r_even = 0
    stock_l_odd = 0
    stock_l_even = 0
    for i in range(n):
        if s[i] == 'R':
            if s[i+1] == 'R':
                stock_r_even += 1
            else:
                cnt[i] += 1 + stock_r_even
                cnt[i+1] += stock_r_odd
                stock_r_odd = 0
                stock_r_even = 0
            stock_r_odd, stock_r_even = stock_r_even, stock_r_odd

        if s[-1-i] == 'L':
            if s[-1-i-1] == 'L':
                stock_l_even += 1
            else:
                cnt[-1-i] += 1 + stock_l_even
                cnt[-1-i-1] += stock_l_odd
                stock_l_odd = 0
                stock_l_even = 0
            stock_l_odd, stock_l_even = stock_l_even, stock_l_odd

    print(*cnt)
    return()

if __name__ == '__main__':
    main()


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())
#define INF 1e18

int main() {
  int N,K;
  cin >> N >> K;
  vi P(N+1);
  vector<ll> C(N+1);
  ll ans = -INF;
  rep1(i,N) cin >> P[i];
  rep1(i,N) cin >> C[i];
  rep1(i,N) {
    ll score = 0;
    int round = 0, p = i;
    vector<ll> S(N+1,-INF);
    vector<bool> used(N+1,false);
    S[i] = 0;
    while (!used[p]) {
      used[p] = true;
      S[P[p]] = S[p] + C[P[p]];
      p = P[p];
      round++;
    }
    if (S[p] > 0) {
      score += S[p]* ((K-1)/round);
      round = (K-1)%round+1;
    }
    p = i;
    while (round>0) {
      round--;
      p = P[p];
      ans = max(ans,score+S[p]);
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3728
package main

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

func main() {
	scan_init()
	k := scanInt()
	//　るんるん数を作って納めて行く方法でいく
	// 00 ~ 99 まではるんるん数だと28通り
	// 0000 ~ 9999 まではるんるん数だと　28*28通り
	queue := []int{1,2,3,4,5,6,7,8,9}
	index := 0
	for len(queue) > 0 {
		index++
		take := queue[0]
		queue = queue[1:]
		if index == k {
			fmt.Println(take)
			break
		}
		for i:= -1; i<=1; i++ {
			d := take%10 + i
			if (d<0 || d>9) {
				continue
			}
			pushval := take*10 + d
			queue = append(queue,pushval)
		}
	}
}
var sc = bufio.NewScanner(os.Stdin)
func scan_init () {
	sc.Split(bufio.ScanWords)
}
func scanInt () int{
sc.Scan()
	i,_ := strconv.Atoi(sc.Text())
	return i
}
//func scan () string{
//  sc.Scan()
//	return sc.Text()
//}

Measured memory_bytes: 8044
#include <stdio.h>

int min(int a, int b){
    if(a>b){
        return b;
    }else
    {
        return  a;
    }
        
}

int main(){
    int n;
    int dp[100010];
    int i,j,k;
    int p[2] = {6,9};

    scanf("%d",&n);

    for(i = 1; i < 100010 ;i++){
        dp[i] = i;
    }

    dp[0] = 0;
    for(k = 0; k <2 ; k++){
     for(i = p[k]; i <=n ;i *=p[k] ){
        for(j = i ; j <= n ; j++){
            dp[j] = min(dp[j],dp[j-i]+1);
        }
     }

    }
    printf("%d\n",dp[n]);

    return 0;


}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i=(a);i<(int)(n);i++)
using namespace std;
typedef long long ll;
struct start { start() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(10);
}; }start;
void in() {}
template <class Head , class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(move(tail)...);
}
template <class T>
  void out(T& t) {
  cout << t << '\n';
}
template <class Head , class... Tail>
void out(Head& head , Tail&... tail) {
  cout << head << ' ';
  out(move(tail)...);
}
int main(void) {
  int ans=700;
  string s;
  in(s);
  rep(i,0,3){
    if(s[i]=='o')ans+=100;
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 256
#https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-11

#DP

L = int(input())

DP = [0 for i in range(5)]

def cost(a):
    if a:
        return [a, a%2, (a+1)%2, a%2, a]
    else:
        return [0, 2, 1, 2, 0]

def list_add(in1, in2):
    return [a + b for a, b in zip(in1, in2)]

for i in range(L):
    n = [min(DP[:i+1]) for i in range(5)]
    a = int(input())
    cos = cost(a)
    DP = list_add(n, cos)



print(min(DP))

Measured memory_bytes: 3064
n = int(input())
s = input()
count = 0
for i in range(0,1000):
    tmp = 0
    for nun,j in enumerate(list(str(i).zfill(3))):
        pretmp = tmp
        tmp = s[tmp:].find(j)
        if tmp < 0:
            break
        if nun == 2 and tmp >= 0:
            count +=1
        tmp = tmp + pretmp + 1
print(count)

Measured memory_bytes: 9152
(* O(n) *)
let fold_int f a n =
  let rec fold f a i n =
    if i >= n then
      a
    else
      fold f (f a i) (i + 1) n
  in
    fold f a 0 n

(* O(n) (n = |s|) *)
let solve s =
  let count1, count2 = fold_int
    (fun (count1, count2) i ->
      let r = i mod 2 in
      if s.[i] = (string_of_int r).[0] then
        count1, count2 + 1
      else
        count1 + 1, count2)
    (0, 0)
    (String.length s)
  in
    min count1 count2

let _ = read_line () |> solve |> string_of_int |> print_endline

Measured memory_bytes: 4736
s = list(input())
n = len(s)
temp = True
for i in range(n):
    if (i+1) %2 == 1:
        if s[i] == "L":
            temp = False
            break
    else:
        if s[i] == "R":
            temp = False
            break
if temp:
    print("Yes")
else:
    print("No")

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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int dist[105][105];
int a[1005], b[1005], c[1005];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n, m; read(n, m);

  rep(i, 0, n) rep(j, 0, n)
    dist[i][j] = i == j ? 0 : 0x3f3f3f3f;
  rep(i, 0, m) {
    read(a[i], b[i], c[i]);
    --a[i], --b[i];
    chmin(dist[a[i]][b[i]], c[i]);
    chmin(dist[b[i]][a[i]], c[i]);
  }
  rep(k, 0, n) rep(i, 0, n) rep(j, 0, n)
    chmin(dist[i][j], dist[i][k] + dist[k][j]);
  int g = 0;
  rep(i, 0, m)
    if (c[i] > dist[a[i]][b[i]])
      g++;
  write(g);
}


Measured memory_bytes: 3660
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        for(int x, y; (x = scn.nextInt()) != 0 | (y = scn.nextInt()) != 0;) {
            System.out.println((x < y ? x : y) + " " + (x > y ? x : y));
        }
    }
}

Measured memory_bytes: 36568
import math

X = int(input())
max_n = int(math.sqrt(X))


def solve(x):
    if x == 2:
        return 2
    if x % 2 == 0:
        x += 1

    for i in range(x, 200001, 2):
        is_prime = True
        for j in range(3, max_n+1, 2):
            if i % j == 0:
                is_prime = False
                break
        if is_prime:
            return i


print(solve(X))


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <string>
#include <cmath>
#define SIZE 100005
#define INF 1000000001

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

int A[SIZE],back[SIZE];

int main()
{
	int n,T;
	scanf("%d %d",&n,&T);
	int mx=0,ret=-1;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
		A[i]=INF-A[i];
		mx=max(mx,A[i]);
		back[i]=mx;
		ret=max(ret,mx-A[i]);
	}
	vector <int> vt;
	int bef=mx+1;
	for(int i=n-1;i>=0;i--)
	{
		if(back[i]-A[i]==ret)
		{
			if(bef>A[i])
			{
				vt.push_back(i);
				bef=A[i];
			}
		}
	}
	int now=0,cnt=0;
	for(int i=((int) vt.size())-1;i>=0;i--)
	{
		int pos=vt[i];
		vector <int> left,right;
		for(int j=now;j<=pos;j++)
		{
			if(A[j]==A[pos]+ret) right.push_back(j);
			else if(A[j]==A[pos]) left.push_back(j);
		}
		//for(int j=0;j<left.size();j++) printf("%d ",left[j]);puts("");
		//for(int j=0;j<right.size();j++) printf("%d ",right[j]);puts("");
		int nm=min(left.size(),right.size());
		for(int j=0;j<left.size();j++)
		{
			int to=lower_bound(right.begin(),right.end(),left[j])-right.begin();
			nm=min(nm,(int) (left.size()-j-1)+to);
		}
		cnt+=nm;
		now=pos+1;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 1408
N, M, *X = map(int, open(0).read().split())


class UnionFind:
    def __init__(self, n=0):
        self.d = [-1]*n
        self.u = n

    def root(self, x):
        if self.d[x] < 0:
            return x
        self.d[x] = self.root(self.d[x])
        return self.d[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return False
        if x > y:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        self.u -= 1
        return True

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

    def size(self, x):
        return -self.d[self.root(x)]

    def num_union(self):
        return self.u


u = UnionFind(N)
for x, y, z in zip(*[iter(X)]*3):
    u.unite(x-1, y-1)
print(u.num_union())


Measured memory_bytes: 40068
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    map<string, int> m; //キーがstring型，要素がint型
    int N;
    cin >> N;
    string temp;
    REP(i,N){
        cin >> temp;
        m[temp]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
    
    return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 1e5 + 123;


void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    ll a;
    cin >> a;
    ll c = a * (a - 1) / 2;
    cout << c << endl;
}

int main()
{
    solve();
    //cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




Measured memory_bytes: 256
<?php

$data = array();
for ($i = 0; $i < 3; $i++)
{
    list($row) = LineIO::read();
    $data[] = str_split($row);
}

$res = '';
for ($i = 0; $i < 3; $i++)
{
    $res .= $data[$i][$i];
}

LineIO::write($res);


class LineIO
{
    public static function read() {
        return explode(' ', trim(fgets(STDIN)));
    }

    public static function write($str = '') {
        echo $str . PHP_EOL;
    }
}


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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}


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

using namespace std;

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

  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

ll dp[100005][13];
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

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

Measured memory_bytes: 10704
#include <iostream>
using namespace std;
int d[50];
int main()
{
  int sum=0,n;
  cin >> n;
  for(int i=0;i<n;i++)
  	cin >> d[i];
    
    for(int i=0;i<n;i++)
    {
      for(int j=i+1;j<n;j++)
      {
        int x=d[i];
        int y=d[j];
        sum=sum+(x*y);
      }
    }
    cout << sum;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var S = ReadLine();

        var RGBList = new List<int>[3] { new List<int>(), new List<int>(),new List<int>() };
        var RGB2Int = new Dictionary<char, int> { { 'R', 0 }, { 'G', 1 }, { 'B', 2 } };

        for (int i = 0; i < N; i++)
        {
            RGBList[RGB2Int[S[i]]].Add(i);
        }

        var RGBCount = new int[3, N];

        for (int i = N - 1; i >= 0; i--)
        {
            if(S[i] == 'R')
            {
                if ((i + 1) < N)
                {
                    RGBCount[0, i] = RGBCount[0, i + 1] + 1;
                    RGBCount[1, i] = RGBCount[1, i + 1];
                    RGBCount[2, i] = RGBCount[2, i + 1];
                }
                else
                {
                    RGBCount[0, i] = 1;
                }
            }
            else if (S[i] == 'G')
            {
                if ((i + 1) < N)
                {
                    RGBCount[0, i] = RGBCount[0, i + 1];
                    RGBCount[1, i] = RGBCount[1, i + 1] + 1;
                    RGBCount[2, i] = RGBCount[2, i + 1];
                }
                else
                {
                    RGBCount[1, i] = 1;
                }
            }
            else if (S[i] == 'B')
            {
                if ((i + 1) < N)
                {
                    RGBCount[0, i] = RGBCount[0, i + 1];
                    RGBCount[1, i] = RGBCount[1, i + 1];
                    RGBCount[2, i] = RGBCount[2, i + 1] + 1;
                }
                else
                {
                    RGBCount[2, i] = 1;
                }
            }
        }

        var ans = 0L;
        var set = new (int, int, int)[6] { (0, 1, 2), (0, 2, 1), (1, 2, 0), (1, 0, 2), (2, 0, 1), (2, 1, 0), };
        var RGB2Char = "RGB";

        foreach (var (C0, C1, C2) in set)
        {
            for (int i = 0; i < RGBList[C0].Count; i++)
            {
                for (int j = 0; j < RGBList[C1].Count; j++)
                {
                    var (C0I, C1I) = (RGBList[C0][i], RGBList[C1][j]);
                    if (C1I <= C0I)
                        continue;

                    ans += RGBCount[C2, C1I];//RGBList[C2].Where(x => C1I < x).Count();

                    var C2I = (C1I - C0I) + C1I;
                    if (C2I < N && S[C2I] == RGB2Char[C2])
                        ans--;
                }
            }
        }

        WriteLine(ans);
    }
}


Measured memory_bytes: 27940
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const MAX_VAL: usize = 100010;

fn main() {
  input! {
    n: usize, w: i64,
    items: [(i64, usize); n]
  };

  let mut dp = vec![vec![std::i64::MAX; MAX_VAL]; n+1];

  dp[0][0] = 0;
  for i in 0..n {
    for j in 0..MAX_VAL {
      let base = dp[i][j];
      if base == std::i64::MAX {
        continue
      }

      dp[i+1][j] = min(dp[i+1][j], base);
      let tj = j+items[i].1;
      if tj < MAX_VAL {
        dp[i+1][tj] = min(dp[i+1][tj], base+items[i].0);
      }
    }
  }

  let mut best = 0;
  for j in 0..MAX_VAL {
      if dp[n][j] <= w {
          best = j;
      }
  }
  println!("{}", best);
}

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

int main()
{
  int k, a, b;
  cin >> k >> a >> b;
  
  do{
    if(a % k == 0){
      cout << "OK";
      break;
    }
    if(a == b)
      cout << "NG";
    a++;
  }while(a <= b);
  
  return 0;
}

Measured memory_bytes: 3604
object Main extends App {
  var a = readInt
  var b = readLine.split(" ").map(_.toInt)
  var c = readLine.split(" ").map(_.toInt)
  var sum = 0L
  for(i <- 0 until a) {
    if(b(i) > 0){
      if(c(i) < b(i)) {     
        sum = sum + c(i)
        c(i)=0
      }
      if(c(i)>=b(i)) {
        sum = sum + b(i)
        c(i) -= b(i)
      }
    }
    
    if(c(i)>0){
      if(c(i) < b(i + 1)) {
        sum = sum + c(i)
        b(i+1) -= c(i)
        c(i)=0
      }
      if(c(i)>=b(i + 1)) {
        sum = sum + b(i+1)
        b(i+1) = 0
      }
    }
  }
  print(sum)
}

Measured memory_bytes: 70604
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int r;
  cin>>r;
  cout<<r*r<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<double> a(n);
	rep(i, n) cin >> a[i];

	rep(i, n) a[i] = 1.0 / a[i];
	double ans = 0;
	rep(i, n) ans += a[i];
	ans = 1.0 / ans;

	printf("%.10f\n", ans);

	return 0;
}

Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };



int main()
{
	int x, y;
	while (cin >> x >> y&&x)
	{
		int a[200][200] = {};
		int f[200][200];
		memset(f, -1, sizeof f);
		pii s;
		for (int i = 1; i <= y; i++)
		{
			for (int j = 1; j <= x; j++)
			{
				char c; cin >> c;
				a[i][j] = c == '#';
				if (c == '&')
				{
					s.first = i;
					s.second = j;
				}
				f[i][j] = INT_MAX;
			}
		}
		
		f[s.first][s.second] = 0;
		queue<pii> que; que.push(s);
		while (!que.empty())
		{
			pii now = que.front(); que.pop();
			for (int i = 0; i < 4; i++)
			{
				pii next = now;
				next.first += dy[i];
				next.second += dx[i];
				if (f[next.first][next.second]>f[now.first][now.second]+(a[now.first][now.second]&&!a[next.first][next.second]) )
				{
					f[next.first][next.second] = f[now.first][now.second] + (a[now.first][now.second] && !a[next.first][next.second]);
					que.push(next);
				}
			}
		}


		int ans = INT_MAX;
		for (int i = 1; i <= y; i++)ans = min({ ans,f[i][1]+a[i][1],f[i][x]+a[i][x] });
		for (int j = 1; j <= x; j++)ans = min({ ans,f[1][j]+a[1][j],f[y][j]+a[y][j] });;
		cout << ans << endl;
	}
}

Measured memory_bytes: 3340
def dijkstra(vertex_num, edge_list, start):
    import heapq
    # cost to each vertex
    d = [float("inf")] * vertex_num
    # start cost is zero
    d[start] = 0
    hq = []
    heapq.heappush(hq, [0, start])
    while len(hq) > 0:
        cost, frm = heapq.heappop(hq)
        for cost, to in edge_list[frm]:
            if d[to] > d[frm] + cost:
                d[to] = d[frm] + cost
                heapq.heappush(hq, [d[to], to])
    return d

n, m, s = map(int, input().split())

adj_list = [[] for _ in range(n)]

for i in range(m):
    frm, to, cost = map(int, input().split())
    adj_list[frm].append([cost, to])

d = dijkstra(n, adj_list, s)

for i in range(len(d)):
    print(d[i]) if d[i] != float("inf") else print("INF")



Measured memory_bytes: 98000
#include<iostream>
#include<math.h>
#include<iomanip>

using namespace std;
typedef long double ld;
static const ld PI = 3.14159265358979323846264338327950;
int main()
{
    ld a, b, h, m;
    cin >> a >> b >> h >> m;
    ld theta = h / (ld)6 * PI+m/(ld)360*PI;
    ld phi = m / (ld)30 * PI;
    ld psi = 2 * PI * (h / 12.0 + m / 60.0 / 12.0 - m / 60.0);
    ld ans = a * a + b * b - 2 * a * b * cosl(psi);
    ans = sqrtl(ans);
    cout <<fixed<<setprecision(15)<< ans << endl;
    return 0;
}

Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch StringPalindrome | diff StringPalindrome.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address StringPalindrome.cpp && ./a.out

/*
 
 3/22/2020
 
 5:03-
 
 */

string S;
bool isp(string s) {
  int l=0,r=SZ(s)-1;
  while(l<r) {
    if(s[l]!=s[r]) return false;
    ++l,--r;
  }
  return true;
}
bool solve() {
  int N=SZ(S);
  string a=S.substr(0,(N-1)/2),b=S.substr((N+3)/2-1);
//  dump(a,b,isp(S),isp(a),isp(b));
  return isp(S)&&isp(a)&&isp(b);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>S;
  cout<<(solve()?"Yes":"No")<<endl;
  
  return 0;
}


Measured memory_bytes: 256