akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int a=gi();
	    //int b=gi();


	    System.out.print(a*a);

//        if (a<10 && b<10) {
//        	System.out.print(a*b);
//        } else {
//        	System.out.print(-1);
//        }


	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35588
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <queue>
using namespace std;
#define MP(x,y) make_pair(x,y)
#define FI first
#define SE second
#define INF 1LL<<60

const int MAXN = 110;
int len;
char str[MAXN],st[MAXN];
long long ans,pos;

long long trans_stoi(int l,int r)
{
	long long res=0;
	for (int i=l;i<r;i++)
		res=res*10+str[i]-'0';
	return res;
}

void trans_itos(long long x)
{
	int num=0;
	int tmp[MAXN];
	while (x)
	{
		tmp[num++]=x%10;
		x/=10;
	}
	for (int i=0;i<num;i++)
		st[i]=tmp[num-i-1]+'0';
	st[num]='\0';
}

long long cal(long long ans)
{
    if (ans<=0) return 0;
	int num=1;
	long long mul=9,p=1,res=0;
	while (ans>p*10)
	{
		res+=num*mul;
		num++;
		mul*=10;
		p*=10;
	}
	res+=(ans-p)*num;
	return res;
}

void judge_0()
{
	long long p=1;
	for (int i=1;i<=len;i++)
	{
		if (str[i]!='0') return;
		p*=10;
	}
	ans=p;
	pos=2;
}

void judge_1()
{
	for (int i=1;i<min(17,len);i++)
	{
		for (int j=1;j<=i;j++) st[j]=str[j];
		st[i+1]='\0';
		int add=1,l=i;
		while (add&&l>0)
		{
			if (st[l]=='9') st[l]='0',add=1;
			else st[l]=st[l]+1,add=0;
			l--;
		}
		for (int j=max(1,2*i-len);j<=i;j++)
		{
			int flag=1;
			for (int p=len,q=i-j;q>=1;p--,q--)
				if (str[p]!=st[q])
				{
					flag=0;
					break;
				}
			if (flag)
			{
				long long tmp=0;
				if (str[i+1]=='0') continue;
				if (j+len-i>=18) continue;
				for (int k=i+1;k<=len;k++) tmp=tmp*10+str[k]-'0';
				for (int k=i-j+1;k<=i;k++) tmp=tmp*10+st[k]-'0';
				if (ans>tmp) ans=tmp,pos=1-i;
			}
		}
	}
}

int cal_len(long long x)
{
    int res=0;
    while (x)
    {
        x/=10;
        res++;
    }
    return res;
}

int main()
{
	int ca=0;
	while (scanf("%s",str+1)!=-1)
	{
		if (str[1]=='#') break;
		len=strlen(str+1);
		ans=INF;
		for (int s=1;s<=len;s++)
			for (int l=s;l<=17&&s+l-1<=len;l++)
			{
				if (str[s]=='0') continue;
				long long tt=trans_stoi(s,s+l);
				long long tmp=tt+1;
				trans_itos(tmp);
				int flag=1;
				int p=s+l,q=p+strlen(st)-1;
				while (flag)
				{
					if (q>len) break;
					for (int i=p,j=0;i<=q;i++,j++)
						if (str[i]!=st[j])
						{
							flag=0;
							break;
						}
					if (!flag) break;
					tmp++;
					trans_itos(tmp);
					p=q+1,q=p+strlen(st)-1;
				}
				if (!flag) continue;
				for (int i=p,j=0;i<=len;i++,j++)
					if (str[i]!=st[j])
					{
						flag=0;
						break;
					}
				trans_itos(tt-1);
				for (int i=s-1,j=strlen(st)-1;i>0;i--,j--)
					if (str[i]!=st[j])
					{
						flag=0;
						break;
					}
				if (flag)
				{
					if (ans>tt)
                        ans=tt-1,pos=cal_len(ans)-s+2;
				}
			}
		judge_1();
		judge_0();
		printf("%lld\n",cal(ans)+pos);
	}
	return 0;
}

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

int main()
{
	int count[101] = {0},value,max;

	while(cin >> value)
	{
		count[value]++;
	}
	max = count[0];
	for(int i=0;i<100;i++)
	{
		if(max < count[i]) max = count[i];
	}
	for(int i=0;i<100;i++)
	{
		if(max == count[i]) cout<<i<<endl;
	}
	return 0;
}

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

string solve() {
    ll K;
    cin >> K;

    vector<ll> p3(18);
    p3[0] = 1LL;
    for ( int i = 1; i < 18; i++ ) {
        p3[i] = p3[i-1] * 3LL;
    }
    ll k = 0;
    ll s = 1;
    string ans;
    for ( int d = 1; d < 18; d++ ) {
        for ( int s = 1; s <= 9; s++ ) {
            for ( ll i = 0; i < p3[d-1]; i++ ) {
                ans.clear();
                int ng = false;
                int x = s;
                ans.push_back('0' + (int)x);
                for ( int j = d-2; j >= 0; j-- ) {
                    ll m = (i / p3[j]) % 3;
                    if ( m == 0 ) {
                        if ( x > 0 ) {
                            x--;
                        } else {
                            ng = true;
                            break;
                        }
                    } else if ( m == 2 ) {
                        if ( x < 9 ) {
                            x++;
                        } else {
                            ng = true;
                            break;
                        }
                    }
                    ans.push_back('0' + (int)x);
                }
                if ( !ng ) {
                    k++;
                    if ( k == K ) return ans;
                }
            }
        }
    }
    return "-1";
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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


int main () {
  int n;
  cin>>n;
  int l[n];
  string ans="";
  for(int i=0;i<n;i++)
  {
    cin>>l[i];
  }
  sort(l,l+n);
  int tmp;
  for(int i=0;i<n-1;i++)tmp+=l[i];
  if(tmp>l[n-1])ans="Yes";
  else ans="No";

  cout<<ans<<endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto h = readln.chomp.split.to!(int[]);
  bool f;
  foreach (i; 1..n) {
    auto d = h[i] - h[i-1];
    if (d == -1) {
      h[i]++;
    } else if (d < 0) {
      f = true;
      break;
    }
  }
  if (f) {
    writeln("No");
  } else {
    writeln("Yes");
  }
}


Measured memory_bytes: 4404
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){
  int N, D, diff, ans = 0;
  int X[20][20];
  bool flag;
  cin >> N >> D;
  for(int i = 0; i < N; i++){
    for(int j = 0;j < D; j++){
      cin >> X[i][j];
    }
  }

  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      int norm = 0;
      for(int k = 0; k < D; k++){
        diff = abs(X[i][k] - X[j][k]);
        norm += diff * diff;
      }
      flag = false;
      for(int k = 0; k <= norm; ++k){
        if(norm == k * k)flag = true;
      }
      if(flag) ++ans;
    }
  }
  cout << ans << endl;
}
//#include <bits/stdc++.h>
//
//using namespace std;
//
//int main() {
//  int N, D; cin >> N >> D;
//  vector<vector<int>> X(N, vector<int>(D));
//  for (int i = 0; i < N; ++i) {
//    for (int j = 0; j < D; ++j) {
//      cin >> X[i][j];
//    }
//  }
//  int ans = 0;
//  for (int i = 0; i < N; ++i) {
//    for (int j = i+1; j < N; ++j) {
//      int norm = 0;
//      for (int k = 0; k < D; ++k) {
//        int diff = abs(X[i][k] - X[j][k]);
//        norm += diff * diff;
//      }
//      // check whether norm = k for some k
//      bool flag = false;
//      for (int k = 0; k <= norm; ++k) {
//        if (k * k == norm) {
//          flag = true;
//        }
//      }
//      if (flag) ++ans;
//    }
//  }
//  cout << ans << endl;
//}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

// mainのそとで定義する f でも G や dpを使うのでグローバルに宣言
// その場合、main で assignする必要があるので注意。
int dp[100010];
vector<vector<int> > G;

// f(x) = x からスタートした時の最長の経路数
int f(int v){
    if(dp[v] != -1) return dp[v];
    
    int res = 0;
    for(auto nv : G[v]){
        res = max(res, f(nv)+1);
    }
    return dp[v] = res;
}

int main(void){
    int n, m;
    cin >> n >> m;
    G.assign(n, vector<int>());
    for(int i=0; i<m; i++){
        int x, y; cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
    }

    for(int i=0; i<n; i++) dp[i] = -1;

    int ans = 0;
    for(int i=0; i<n; i++) ans = max(ans, f(i));
    cout << ans;

    return 0;
}

Measured memory_bytes: 8192
A, B, C = map(int, input().split())

count = 0
if A > B:
    for i in range (B, A):
        if i == C:
            count = 1
elif A < B:
    for i in range (A, B):
        if i == C:
            count = 1

if count == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())
ans = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print ans


Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int N;
	cin >> N;
	int A;
	cin >> A;
	int sum = A;
	for (int i = 1; i < N-1; i++)
	{
		int B;
		cin >> B;
		sum += min(A, B);
		A = B;
	}
	sum += A;
	cout << sum << endl;
}



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

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

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

using namespace std;

int main ()
{
  int N;
  cin >> N;
  REPI (3){
    if (N%10 == 7){
      printf("Yes\n");
      return 0;
    }
    N /= 10;
  }
  printf("No\n");
  return 0;
}

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

int main(void) {

  int X,max=0,new_max=0;
  cin >> X;

  for(int i=1;i<=31;i++){
    for(int j=2;j<=10;j++){
      new_max =pow(i,j);
      if (((X-new_max)>=0) && ((X-new_max)<=(X-max))){
        max = new_max;
      }
    }
  }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BResale solver = new BResale();
        solver.solve(1, in, out);
        out.close();
    }

    static class BResale {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] arr = new int[n];
            int[] arr2 = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
            }
            for (int i = 0; i < n; i++) {
                arr2[i] = in.nextInt();
            }
            long sum = 0;
            for (int i = 0; i < n; i++) {
                if (arr[i] > arr2[i]) {
                    sum += arr[i] - arr2[i];
                }
            }
            out.println(sum);
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define sosuu 1000000007

int length2(int x1,int y1,int x2,int y2){
return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
int main(){
  int N;
  cin >> N;
  vector<pair<int, int>> xy(N);
  double ans=0;
  rep(i, N)
    cin >>xy.at(i).first>>xy.at(i).second;
  rep(i, N-1){
  rep2(j,i+1, N){
  ans+=sqrt(length2(xy.at(i).first,xy.at(i).second,xy.at(j).first,xy.at(j).second));
  }
  }
  ans=ans*2/N;
printf("%.20lf\n", ans);

}

Measured memory_bytes: 256
# C
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    A[a-1] = max(A[a-1], H[b-1])
    A[b-1] = max(A[b-1], H[a-1])
    
res = sum([H[i] > A[i] for i in range(N)])
print(res)

Measured memory_bytes: 19956
scan :: Int -> Int -> [[Int]] -> Int
scan h w = iter 0 where
    iter c [] = c
    iter c ([a, b]:xs)
        | a >= h && b >= w = iter (c+1) xs
        | otherwise = iter c xs
    
readData :: Int -> IO [[Int]]
readData 0 = return []
readData n = do
    line1 <- getLine
    let xs = map (\x -> read x :: Int) (words line1)
    fmap (xs:) $ readData (n-1)
        
main :: IO() 
main = do
    line1 <- getLine
    let [stN, stH, stW] = words line1
        n = read stN :: Int
        h = read stH :: Int
        w = read stW :: Int
    l <- readData n
    let ans = scan h w l
    print ans


Measured memory_bytes: 2300
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}
double max(double a, double b) {
	if (a < b) return b;

	return a;
}


ll N, K;
vector<ll> a, slist;
ll sum[1000];
int main() {

	cin >> N >> K;

	a.resize(N);



	rep(i, N) {
		cin >> a[i];
		if (i != 0)
			sum[i] = sum[i - 1] + a[i];
		else
			sum[i] = a[i];
	}

	for (int l = 0; l < N; l++) {
		for (int r = l; r < N; r++) {

			slist.push_back(sum[r] - sum[l] + a[l]);
		}
	}

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

	ll ans = 0, sum = 0;
	for (int i = 40; i >= 0; i--) {
		for (int j = 0; j < slist.size(); j++) {
			if ((((1LL << i) + ans) & slist[j]) == ans + (1LL << i)) {
				sum += 1;
			}
		}
		if (sum >= K) {
			ans += (1LL << i);
		}
		sum = 0;
	}

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

Measured memory_bytes: 5748
//71
#include <stdio.h>

#define MAX_TRAIN	( 10 )

void trainAdd( int addTrainNumber );
int trainGone( void );

int nowTrainArray;
int trainArray[ MAX_TRAIN ];

int main( void )
{
	int trainNumber;
	
	int i;
	
	while( scanf( "%d", &trainNumber ) != EOF )
	{
		if( trainNumber == 0 )
		{
			printf( "%d\n", trainGone() );
		}
		else
		{
			trainAdd( trainNumber );
		}
	}
	
	return (0);
}

void trainAdd( int addTrainNumber )
{
	trainArray[ nowTrainArray ] = addTrainNumber;
	nowTrainArray++;
}

int trainGone( void )
{
	nowTrainArray--;
	return ( trainArray[ nowTrainArray ] );
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
map<ll,ll>b;
ll n,a[N],ans; 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	    cin>>a[i],b[a[i]]++;
	for(int i=1;i<=n;i++)
	{
		if(b[a[i]]>a[i]) ans+=b[a[i]]-a[i],b[a[i]]=a[i];
		else if(b[a[i]]<a[i]) ans+=b[a[i]],b[a[i]]=0;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 7040
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<set>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> p(n), inv(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
        inv[p[i]-1] = i;
    }
    multiset<int> ind;
    ind.insert(inv[n-1]);
    ind.insert(-1); ind.insert(-1);
    ind.insert(n); ind.insert(n);
    ll ans = 0;
    for(int i = n-2; i >= 0; i--){
        int center = inv[i];
        auto r = ind.upper_bound(center);
        auto l = r;
        l--;
        auto l2 = l;
        l2--;
        auto r2 = r;
        r2++;
        ans += (ll)(center-(*l))*((*r2)-(*r))*(i+1);
        ans += (ll)((*l)-(*l2))*((*r)-center)*(i+1);
        ind.insert(center);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

int main(){
    ll n;cin>>n;
    ll a[n+1];rep(i,1,n)cin>>a[i];
    ll m=0;
    ll ans[n+1];memset(ans,0,sizeof(ans));
    for(ll i=n;i>=1;i--){
        ll c=0;
        for(ll j=2*i;j<=n;j+=i){
            if(ans[j]==1)c++;
        }
        if(abs(c-a[i])%2==1){
            ans[i]=1;
            m++;
        }
    }
    cout<<m<<endl;
    rep(i,1,n){
        if(ans[i]==1)cout<<i<<" ";
    }
    
    return 0;
}







Measured memory_bytes: 3968
/*
author:Manson
date:7.7.2018
theme:
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1005;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b;
	cin>>a>>b;
	if(a == 2||b == 2){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}


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

#define ll long long
#define f first
#define s second
#define inf 1e15

#define N 300005

int n,m,x,y;
int a[N];

int visited[1001][1001];

int dr[]={0,0,-1,1};
int dc[]={-1,1,0,0};

int valid(ll x,ll y){
    return (x>=0 && x<n && y>=0 && y<m);
}

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
	int t=1;
	//cin>>t;
	while(t--){
	    
	    //input
	    cin>>n>>m;
	    
	    int mat[n][m];
	    
	    int a,b,c,d;
	    cin>>a>>b>>c>>d;
	    
	    a--;b--;c--;d--;
	    
	    string s;
	    
	    for(int i=0;i<n;i++){
	        cin>>s;
	        for(int j=0;j<m;j++){
	            mat[i][j]=(s[j]=='.');
	        }
	    }
	    
	    deque<pair<pair<ll,ll>,ll>>q;
	    
	    q.push_front({{a,b},0});
	    
	    while(!q.empty()){
	        
	       // cout<<"hello\n";
	        pair<pair<ll,ll>,ll> x=q.front();
	        
	        q.pop_front();
	        
	        pair<ll,ll> pos=x.f;
	        
	        if(pos.f==c && pos.s==d){
	            cout<<x.s;
	            return 0;
	        }
	       // cout<<"start\n";
	        
	       // cout<<"end\n";
	        visited[pos.f][pos.s]=1;
	        
	        //0
	        for(int i=0;i<4;i++){
	            
	            int u=pos.f+dr[i];
	            int v=pos.s+dc[i];
	            
	            
	            if(valid(u,v) && !visited[u][v] && mat[u][v] ){
	                
	               // cout<<"hello2\n";
	                q.push_front({{u,v},x.s});
	            }
	        }
	        //1
	        for(int dr=-2;dr<=2;dr++){
	            for(int dc=-2;dc<=2;dc++){
	            
	            int u=pos.f+dr;
	            int v=pos.s+dc;
	            
	            if(valid(u,v) && !visited[u][v] && mat[u][v] ){
	                
	                q.push_back({{u,v},x.s+1});
	            }
	         }
	        }
	        
	    
	    
	    }
	    cout<<-1<<"\n";
	    
	    
	}
	return 0;
}


Measured memory_bytes: 20576
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
//#include <algorithm>
#include<set>
#include <limits>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_5 100000
#define d9_7 1000000007
int main(void){
  int n,a,b,c,d;
  cin >> n>>a>>b>>c>>d;
  string s;
  cin >> s;
  a--;b--;c--;d--;
  vector<bool> c1(n,false);
  vector<bool> d1(n,false);
  if(s[c]=='.')c1[c]=true;
  for(int i=c;i>0;i--){
    if(c1[i]==false)continue;
    if(i-1>=0){
      if(s[i-1]=='.'){
        c1[i-1]=true;
      }
    }
    if(i-2>=0){
      if(s[i-2]=='.'){
        c1[i-2]=true;
      }
    }
  }
  if(s[d]=='.')d1[d]=true;
  for(int i=d;i>0;i--){
    if(d1[i]==false)continue;
    if(i-1>=0){
      if(s[i-1]=='.'){
        d1[i-1]=true;
      }
    }
    if(i-2>=0){
      if(s[i-2]=='.'){
        d1[i-2]=true;
      }
    }
  }
  if(!(c1[a]==true && d1[b]==true)){
    cout<<"No"<<endl;
    return 0;
  }
  if(a<b && c<d || a>b && c>d){
    cout<<"Yes"<<endl;
  }else if(a>b && c<d){//b,a,c,d
    for(int i=c;i>=a;i--){
      if(i>n-2)continue;
      if(i==0)break;
      if(s[i]=='.' && s[i-1]=='.'&& s[i+1]=='.' &&i+1!=a){
        cout<< "Yes"<<endl;
        return 0;
      }else{
        continue;
      }
    }
    cout<<"No"<<endl;
  }else if(a<b && c>d){
    for(int i=d;i>=b;i--){
      if(i>n-2)continue;
      if(i==0)break;
      if(s[i]=='.' && s[i-1]=='.'&& s[i+1]=='.' &&i+1!=b){
        cout<< "Yes"<<endl;
        return 0;
      }else{
        continue;
      }
    }
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 640
from collections import deque


def check(s):
    x = 0
    for i in range(len(s)):
        if s[i] == "(":
            x += 1
        else:
            x -= 1

        if x < 0:
            return False

    if x == 0:
        return True
    else:
        return False


def main():
    n, s = int(input()), input()

    ss, q = "", deque()
    for i in range(len(s)):
        if s[i] == "(":
            ss += "("
        else:
            if len(ss) != 0:
                ss += ")"
                if check(ss):
                    q.append(ss)
                    ss = ""
            else:
                ss = "("
                while len(q) != 0:
                    ss += q.popleft()
                ss += ")"
                q.append(ss)
                ss = ""

    if len(ss) != 0:
        c = 0
        for i in range(len(ss)):
            if ss[i] == "(":
                c += 1
            else:
                c -= 1
        ss += ")" * c

    s = ""
    while len(q) != 0:
        s += q.popleft()

    print(s+ss)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
long N,M,c,n=1,m=1e9+7,h,r,d;main(i){for(scanf("%d%d",&N,&M);M/++i/i;n=n*r%m){for(;M%i<1;++c)M/=i;for(r=d=1;c;r=r*(N+c)%m)d=d*c--%m;for(h=2*m-4;h/=2;d=d*d%m)r=h%2?r*d%m:r;}printf("%d",n*(M>1?N:1)%m);}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::vector;
using std::queue;
using std::priority_queue;
using std::greater;
using std::max;
using std::min;

using lli = long long int;
using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N;
lli in, xy[2]={-1, -1}, s=0;
vector<lli> A;

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> in;
		A.push_back(in);
	}
	sort(A.begin(), A.end(), greater<int>());
	for(auto i : A){
		if(xy[s] < 0) xy[s] = i;
		else if(xy[s] == i)	s++;
		else xy[s] = i;

		if(s == 2) break;
	}
	if(s < 2)cout << 0;
	else cout << xy[0]*xy[1];
  return 0;
}


Measured memory_bytes: 1400
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void SAY(bool YES){cout<<(YES?"YES":"NO")<<endl;};
void Say(bool Yes){cout<<(Yes?"Yes":"No")<<endl;};

typedef pair<ll, ll>P;

ll N;
vector<ll>path[101010];

ll from[101010];

ll priori[101010];

ll flg[101010];


int main(){

    cin >> N;
    for(ll i = 1; i < N; i++){
        ll a, b;
        cin >> a >> b;
        path[a].push_back(b);
        path[b].push_back(a);
    }

    queue<ll>Q;
    Q.push(1);
    from[1] = -1;
    while(!Q.empty()){
        ll idx = Q.front();
        Q.pop();
        for(ll i = 0; i < path[idx].size(); i++){
            ll nxt = path[idx][i];
            if(from[nxt] == 0){
                from[nxt] = idx;
                Q.push(nxt);
            }
        }
    }
    for(ll i = from[N]; i > 1;i = from[i])priori[i] = 1;

    priority_queue<P>PQ[2];
    PQ[0].push(P(1, 1));
    PQ[1].push(P(1, N));
    for(ll i = 0; ; i++){
        ll p = i % 2;
        ll idx = -1;
        while(!PQ[p].empty()){
            ll nxt = PQ[p].top().second;
            PQ[p].pop();
            if(flg[nxt])continue;
            idx = nxt;
            break;
        }
        if(idx == -1){
            if(p == 0)cout << "Snuke" << endl;
            else cout << "Fennec" << endl;
            return 0;
        }
        flg[idx] = 1;
        for(ll j = 0; j < path[idx].size(); j++){
            ll nxt = path[idx][j];
            if(flg[nxt])continue;
            if(priori[nxt])PQ[p].push(P(1, nxt));
            else PQ[p].push(P(0, nxt));
        }
    }


    return 0;
}

Measured memory_bytes: 8320
"山手線"
a, b, c = map(int, input().split())

flag = True
if a+b == 60 and c > a:  # 必ず辿りつけない
    print(-1)
else:
    right = 0
    left = a
    i = 0
    while True:
        # print('left : ', left)
        # print('right : ', right)
        # print('c : ', c)
        if left >= c and c >= right:
            print(c)
            break
        if left+b > c and c > right+a:
            c += 60
        left += (b+a)
        right += (a+b)
        i += 1
        if i > 60:
            print(-1)
            break



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

unordered_map<long, long> mp;
unordered_map<long, long> mp2;

int main()
{
    int a,b,c,a2,b2,c2;
    int k;
    int l,m,n;

    cin >> a;
    cin >> b;
    cin >> c;
    cin >> k;

    for(int i = 1; i <= k * 100; i++){
        a2 = a * pow(2,(i / 100));
        l = i % 100;
        b2 = b * pow(2,(l/ 10));
        m = l % 10;
        c2 = c * pow(2,m);

        if ((i / 100) + (l / 10) + m > k)
        {
            continue;
        }
        if(c2 > b2 && b2 > a2){
            cout << "Yes\n";
            return 0;
        }
    }

    cout << "No\n";
    return 0;
}

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

int main() {
    int A , B;
    cin >> A >> B;
    if(A<10&&B<10){
        cout << A*B << endl;
    }else
    
    cout<< -1 <<endl;
    return 0;    
}

Measured memory_bytes: 256
# 考えると、隣り合う列は結局 2*H 回ずることになり、
# それぞれの列間について最適な沈め順を見つけると、
# その順序関係を崩さないように全体の順番も構築できる（トポロジカルソートみたいに）ので、
# 各列間の最適解を求めて総和をとればいい

def accumulate_reverse(S1, S2):
    n = min(len(S1), len(S2))
    res = [0] * (n+1)
    c = 0
    for i in range(n):
        if S1[i] == S2[i]:
            c += 1
        res[n-i-1] = c
    return res

inf = 10**8
H, W = map(int, input().split())
C = [input() for _ in range(H)]
C_T = list(zip(*C))
C_T = ["".join(s) for s in C_T]
ans = 0
for C1, C2 in zip(C_T[:-1], C_T[1:]):
    # Z[i][j] := i 個ずれてて沈んでない方が j 個沈んでる状態の連結個数
    Z1 = []  # 左を押したとき（右が上にあるとき）
    Z2 = []  # 右を押したとき（左が上にあるとき）
    Z1.append(accumulate_reverse(C1, C2))
    for j in range(1, H+1):
        Z1.append(accumulate_reverse(C1, C2[j:]))
        Z2.append(accumulate_reverse(C1[j:], C2))
    Z1 += Z2[::-1]
    # dp[i][j] := 左を i 個、右を j 個沈めるまでの最小コスト  # 逆かも（どっちでもいい）
    dp = [[inf] * (H+2) for _ in range(H+2)]
    dp[0][0] = 0
    for j in range(H+1):
        for k in range(H+1):
            cost = dp[j][k] + Z1[j-k][min(j, k)]
            dp[j+1][k] = min(dp[j+1][k], cost)
            dp[j][k+1] = min(dp[j][k+1], cost)
    ans += dp[H][H]
print(ans)


Measured memory_bytes: 142508
#include<stdio.h>
#include<string.h>
#include<time.h>
int x,y,dx[8]={0,1,1,1,0,-1,-1,-1},dy[8]={1,1,0,-1,-1,-1,0,1},co[191],sps,final;
char dic[191][1000][191],sp[1000][191];
void ans(char map[20][10],int nx,int ny,int dir){
	int fx,fy,len,po,qw,sw,ck;
	char dam[191]={};
	fx=nx;
	fy=ny;
	len=0;
	while(1){
		dam[len]=map[nx][ny];
		len++;
		if(len>=final){
			sw=ck=0;
			for(po=0;po<sps;po++){
				if(strcmp(sp[po],dam)==0){
					ck++;
					break;
				}
			}
			if(ck==0){
				for(po=0;po<co[len];po++){
					if(strcmp(dic[len][po],dam)==0){
						if(final<strlen(dam)){
							strcpy(sp[0],dam);
							sps=1;
							final=strlen(dam);
						}
						else{
							strcpy(sp[sps],dam);
							sps++;
						}
						sw++;
						break;
					}
				}
			}
			if(sw==0&&ck==0){
				strcpy(dic[len][co[len]],dam);
				co[len]++;
			}
		}
		nx=(nx+dx[dir]+x)%x;
		ny=(ny+dy[dir]+y)%y;
		if(nx==fx&&ny==fy){
			break;
		}
	}
	return;
}
int main(void){
	int i,j,k,maxl,t0,t1,tsum=0;
	char dn[20][10],nu;
	for(k=0;k<191;k++){
		co[k]=0;
		for(i=0;i<1000;i++){
			for(j=0;j<191;j++){
				dic[k][i][j]=sp[i][j]=0;
			}
		}
	}
	for(i=0;i<20;i++){
		for(j=0;j<10;j++){
			dn[i][j]=0;
		}
	}
	while(1){
		t0=clock();
		scanf("%d %d",&y,&x);
		if(x==0&&y==0){
			break;
		}
		for(k=0;k<191;k++){
			if(co[k]==0){
				continue;
			}
			co[k]=0;
			for(i=0;i<1000;i++){
				if(dic[k][i][0]==0){
					continue;
				}
				for(j=0;j<191;j++){
					if(dic[k][i][j]==0){
						break;
					}
					dic[k][i][j]=0;
				}
			}
		}
		for(i=0;i<1000;i++){
			if(sp[i][0]==0){
				continue;
			}
			for(j=0;j<191;j++){
				sp[i][j]=0;
			}
		}
		for(i=0;i<20;i++){
			if(dn[i][0]==0){
				break;
			}
			for(j=0;j<10;j++){
				dn[i][j]=0;
			}
		}
		i=j=0;
		while(1){
			scanf("%c",&nu);
			if(nu!='\n'){
				dn[i][j]=nu;
				i++;
				if(i==x){
					i=0;
					j++;
				}
				if(j==y){
					break;
				}
			}
		}
		sps=0;
		final=2;
		for(i=0;i<x;i++){
			for(j=0;j<y;j++){
				for(k=0;k<8;k++){
					ans(dn,i,j,k);
				}
			}
		}
		/*
		for(i=0;i<191;i++){
			printf("%d:%d",i,co[i]);
			if(i==final){
				printf("***");
			}
			printf("\n");
		}
		*/
		maxl=final;
		final=0;
		for(i=1;i<sps;i++){
			if(strcmp(sp[final],sp[i])>0){
				final=i;
			}
		}
		if(strlen(sp[final])==0){
			printf("0\n");
		}
		else{
			for(i=0;i<maxl;i++){
				printf("%c",sp[final][i]);
			}
			printf("\n");
		}
		t1=clock();
		//printf("time %d\n",t1-t0);
		tsum+=t1-t0;
	}
	//printf("Sum %d\n",tsum);
	return 0;
}

Measured memory_bytes: 36428
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
// #define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
bool desc_sort(const int & lhs,const int & rhs)
{
    return lhs>rhs;
}
bool desc_pii_sort(const pii & lhs , const pii & rhs)
{
    return lhs>rhs;
}
bool second_sort(const pii & lhs , const pii & rhs)
{
    pii a,b;
    a.F = lhs.S;
    a.S = lhs.F;
    b.F = rhs.S;
    b.S = rhs.F;
    return a<b;
}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
    #define trace(...)
#endif


// #define int long long
#define modd 1e0



inline ll fast_expo(ll base,ll power,ll modulo=modd){
    base%=modulo;
    if (base<0LL) base+=modulo;
    ll x=base,cnt=power,ans=1LL;
    while(cnt){
        if (cnt&1LL) ans=(ans*x)%modulo;
        x=(x*x)%modulo;
        cnt>>=1LL;
    }
    // int tmp=ans;
    return ans;
}
inline ll inv(ll base,ll modulo=modd){
    return fast_expo(base,modulo-2LL,modulo);
}



signed main()
{
    #ifdef _SUBLIME
    ifstream cin("input.txt");
    ofstream cout("output.txt");
    #endif
    fio;
    int n;
    cin>>n;
    n = n%1000;
    n = 1000-n;
    n = n%1000;
    d1(n);
    return 0;
}

Measured memory_bytes: 3644
#n = int(input())
n, m, x, y = map(int,input().split())
#ls = list(map(int,input().split()))
#ls = [list(map(int,input().split())) for i in range(n)]
#ls = [int(input()) for i in range(n)]

xls = list(map(int,input().split()))
yls = list(map(int,input().split()))

for i in range(x+1,y):
  if max(xls) < i <= min(yls):
    print("No War")
    quit()
print("War")

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
  string s;
  cin >> s;
  if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
  {
    cout << "Bad";
  }
  else
  {
    cout << "Good";
  }
  
  return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

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

	int a[15];
	pii v[15][15];
	for (int i = 0; i < n; i++){
		cin>>a[i];
		for (int j = 0; j < a[i]; j++){
			int x,y;
			cin>>x>>y;
			x--;
			v[i][j]=pii(x,y);
		}
	}

	int ans=0;
	for (int i = 0; i < (1<<n); i++){
		int tb[16];
		memset(tb,0,sizeof(tb));
		int cnt=0;
		bool ok=true;
		vector<pii> pu;
		for (int j = 0; j < n; j++){
			if(i&(1<<j)){
				cnt++;
				for (int k = 0; k < a[j]; k++){
					int x1=v[j][k].first;
					int y1=v[j][k].second;

					if(y1==0){
						if(i&(1<<x1))ok =false;
					}
					if(y1==1){
						if(!(i&(1<<x1)))ok=false;
					}

				}
			}
		}

		if(ok){
			chmax(ans,cnt);
		}

	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

if m == 1:
    print(1)
    exit()

mod = 10**9+7

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

mod = 10**9+7
N = 10**6
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)

for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

d = factorize(m)
ans = 1
for k, v in d.items():
    ans *= cmb1(v+n-1, n-1, mod)
    ans %= mod
print(ans)


Measured memory_bytes: 89080
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    bool flag = 1;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++){
        if(a[i]%2==0){
            if (!(a[i]%3==0||a[i]%5==0)) flag = 0;
        }
    }
    if(flag) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby



$visited = []
$pre_vertex = []


def min a,b
  if a<b then return a else b end
end

def init_dfs v,e
  $visited = Array.new(v,false)
  $pre_vertex = Array.new(v,false)
end

#b -> e ??§edges
def bfs b,e,es
  q = []
  q.push(b)
  loop do
    if q.empty? then return end
    u = q.shift
    if u == e then return end
    es[u].each_with_index do |c,v|
      if !$visited[v] and c>0 then
        $visited[v] = true
        $pre_vertex[v] = u
        q.push(v)
      end
    end
  end
end


def back_trace v,e,es
  flow =[]
  min_c = 10e8

  to = v-1
  from = $pre_vertex[v-1]
  flow=[[from,to]]+flow
  min_c = min(min_c,es[from][to])

  while from != 0
    to = from
    from = $pre_vertex[from]
    flow=[[from,to]]+flow
    min_c = min(min_c,es[from][to])
  end
  return flow,min_c
end



v_size,e_size = gets.chomp.split(/ /).map{|i| i.to_i}

edges = Array.new(v_size).map{ Array.new(v_size,0)}


e_size.times do
  u,v,c = gets.chomp.split(/ /).map{|i| i.to_i}
  edges[u][v]=c
end

  @ans = 0
loop do
  init_dfs(v_size,e_size)
  bfs(0,v_size-1,edges)
  if $visited[v_size-1] then
    f,min_c = back_trace(v_size,e_size,edges)
    f.each do |i|
      edges[i[0]][i[1]]-=min_c
      edges[i[1]][i[0]]+=min_c
    end
    @ans = @ans+ min_c
  else
    p @ans
    break
  end
end

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

int main(){
  int n; cin >> n;
  vector<int> L(2 * n);
  for(int i = 0; i < 2 * n; i++) cin >> L[i];
  sort(L.begin(), L.end());
  int ans = 0;
  for(int i = 0; i < n; i++) ans += L[2 * i];
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int ans = 700;
		for(int i = 0; i < 3; i++) {
			if(s.charAt(i) == 'o') {
				ans += 100;
			}
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 23764
#include <stdio.h>

int main(void){
	int H, W, i, j;
	while(1){
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0){
			break;
		}
		for(i = 0; i < H; i++){
			for(j = 0; j < W; j++){
				if((i + j) % 2 == 0 ){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef complex<double> point;
struct circle { point p; double r; };
struct line { point p, q; };

const double eps = 1e-9;

double sign(double x) { return x < -eps ? -1 : x > eps; }

circle read(){
	double x, y, r; cin >> x >> y >> r;
	return {point(x, y), r};
}

namespace std
{
	bool operator<(point a, point b)
	{
		if (a.real() != b.real())
			return a.real() < b.real();
		return a.imag() < b.imag();
	}
}

// circle-circle intersection
vector<point> intersect(circle C, circle D)
{
	double d = abs(C.p - D.p);
	if (sign(d - C.r - D.r) > 0) return {};       // too far
	if (sign(d - abs(C.r - D.r)) < 0) return {}; // too close
	double a = (C.r*C.r - D.r*D.r + d*d) / (2*d);
	double h = sqrt(C.r*C.r - a*a);
	point v = (D.p - C.p) / d;
	if (sign(h) == 0) return {C.p + v*a};         // touch
	return {C.p + v*a + point(0,1)*v*h,           // intersect
			C.p + v*a - point(0,1)*v*h};
}

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

	circle c1 = read(), c2 = read();
	auto ans = intersect(c1, c2);
	if (ans.size() == 1) ans.push_back(ans[0]);
	sort(ans.begin(), ans.end());
	cout.precision(10);
	for (auto pp : ans)
		cout << fixed << pp.real() << " " << pp.imag() << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 1316
N, K = map(int, input().split())
arr = list(map(int, input().split()))

ans = float('inf')
for i in range(N+1-K):
    if arr[i]<= 0 and arr[i+K-1]>0:
        preans = min(abs(arr[i]*2) + arr[i+K-1], abs(arr[i]) + arr[i+K-1]*2)
    elif arr[i]<=0 and arr[i+K-1]<=0:
        preans = abs(arr[i])
    elif arr[i]>=0 and arr[i+K-1]>=0:
        preans = arr[i+K-1]
    ans = min(ans,preans)

print(ans)

Measured memory_bytes: 14564
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n;
  cin>>n;
   set<string>s;
  for(int i=0;i<n;++i){
    string j;
    cin>>j;
    s.insert(j);
}
 
  
  cout<<s.size();
	return 0;
}

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

int main(){

    string S;
    cin >> S;

    long long K;
    cin >> K;

    int not1_pos;
    int i=0;
    while(S[i] == '1'){
        i++;
    }
    not1_pos = i;

    if(not1_pos < K){
        cout << S[not1_pos] << endl;
    }else{
        cout << 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

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

	string S;
	cin >> S;
	int cnt = 0, ans = 0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == 'R') {
			cnt++;
			if (ans < cnt) {
				ans = cnt;
			}
		} else {
			cnt = 0;
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner fc = new FastScanner(System.in);
		int N = fc.nextInt();
		int[] t = new int[N + 1];
		int[] x = new int[N + 1];
		int[] y = new int[N + 1];

		t[0] = 0;
		x[0] = 0;
		y[0] = 0;

		for (int i = 0; i < N; i++) {
			t[i + 1] = fc.nextInt();
			x[i + 1] = fc.nextInt();
			y[i + 1] = fc.nextInt();
		}

		boolean can = true;
		for(int i = 0; i < N; i++) {
			int dt = t[i + 1] - t[i];
			int dist = Math.abs(x[i + 1] - x[i]) + Math.abs(y[i + 1] - y[i]);
			if (dt < dist) can = false;
			// dt と distの偶奇は一致する
			if (dist % 2 != dt % 2) can = false;
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}


	}

	static class FastScanner {

		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;

	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }

	}

}



Measured memory_bytes: 42612
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    int a;
    cin>>a;
    int b, c;
    b=a/100;
    c=a%100;


    if(0<b&&b<=12 && 0<c&&c<=12)
        cout<<"AMBIGUOUS";
    else if(0<b&&b<=12 && (c>12||c==0))
        cout<<"MMYY";
    else if((b>12||b==0)&& 0<c&&c<=12)
        cout<<"YYMM";
    else
        cout<<"NA";

}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n, a, b, i, j, x;
    int sum1=0, sum2=0;

    scanf("%d", &n);
    scanf("%d", &a);
    scanf("%d", &b);



    for(i=1; i<=n; i++){
        sum1 = 0;
        x = i;
        for(j=0; j<10; j++){
            sum1 = sum1 + (x % 10);
            x = x / 10;
        }
        if(sum1 >= a && sum1 <= b){
            sum2 = sum2 + i;
        }
    }

    printf("%d\n", sum2);

    return 0;
}

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

int main() {
	ll n,a,b,p,q;
	cin>>n>>a>>b;
	
	p=n/(a+b);
	q=n%(a+b);
	
	if(q>=a)cout<<a*p+a<<endl;
	else cout<<a*p+q<<endl;
}

//REで謎

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int h1, m1, h2, m2, k;
    cin >> h1  >> m1 >> h2 >> m2 >> k;
    int t1 = h1 * 60 + m1;
    int t2 = h2 * 60 + m2;
    cout << max(0, t2 - t1 - k) << endl;
}


Measured memory_bytes: 3640