akhauriyash/Code-Regression huggingface dataset:
using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var b = Array.ConvertAll(line, int.Parse);
        var a = new List<int>();
        a.Add(0); a.AddRange(b); a.Add(0);
        var t = 0L;
        for (int i = 0; i < a.Count() - 1; i++)
            t += Math.Abs(a[i] - a[i + 1]);
        for (int i = 1; i < a.Count() - 1; i++)
        {
            var ret = t - Math.Abs(a[i - 1] - a[i]) - Math.Abs(a[i] - a[i + 1]) + Math.Abs(a[i - 1] - a[i + 1]);
            Console.WriteLine(ret);
        }
    }
}


Measured memory_bytes: 28636
n = [int(i) for i in input()]
cnt = 1
for i in range(1,len(n)):
    if n[i] == n[i-1]:
        cnt += 1
        if cnt == 3:
            break
    else:
        cnt = 1

if cnt >= 3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include<stdio.h>
int main(){
  int w,h,a[51][51],i,j,i2,j2,c,k;
  while(1){
    //syokika
    for(i=0;i<51;i++){
      for(j=0;j<51;j++){
	a[i][j]=0;
      }
    }
    c=2;
  
    scanf("%d%d",&w,&h);
    if(w==0&&h==0)break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	scanf("%d",&a[i][j]);
      }
    }
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	if(a[i][j]==1){
	  a[i][j]=c;
	  k=1;
	  while(k!=3){
	    k=1;
	    //go
	    for(i2=0;i2<h;i2++){
	      for(j2=0;j2<w;j2++){
		//someru
		if(a[i2][j2]==1){
		  if(j2!=0){
		    if(a[i2][j2-1]==c){
		      a[i2][j2]=c; //left
		      k=2;
		    }
		  }
		  if(i2!=0){
		    if(a[i2-1][j2]==c){
		      a[i2][j2]=c; //up
		      k=2;
		    }		    

		    if(j2!=0){
		      if(a[i2-1][j2-1]==c){
			a[i2][j2]=c; //left up
			k=2;
		      }
		    }
		    if(a[i2-1][j2+1]==c){
		      a[i2][j2]=c; //right up
		      k=2;
		    }
		    
		  }
		}
		//some end
	     
	      }
	    }

	    //back
	    for(i2=h-1;i2>=0;i2--){
	      for(j2=w-1;j2>=0;j2--){
		//someru
		if(a[i2][j2]==1){
		  if(a[i2][j2+1]==c){
		    a[i2][j2]=c; //right
		    k=2;
		  }    
		  if(a[i2+1][j2]==c){
		    a[i2][j2]=c; //down
		    k=2;
		  }		
		  if(a[i2+1][j2+1]==c){
		    a[i2][j2]=c; //right do
		    k=2;
		  }
		  if(j2!=0){
		    if(a[i2+1][j2-1]==c){
		      a[i2][j2]=c; //left do
		      k=2;
		    }
		  }
		}
		
		
		//some end
		
	      }
	    }
	    if(k==1)k=3;
	    //sima end
	  }
	  c++;
	}
      }
    }
    printf("%d\n",c-2);
  }
  return 0;
}

Measured memory_bytes: 1036
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
 
static const int N = 1000;
 
int lcs(string X, string Y) {
 int c[1001][1001];

 int m = X.size();
 int n = Y.size();
 int maxl = 0;
 X = ' ' + X;
 Y = ' ' + Y;
 for (int i = 0; i <= m; i++) c[i][0] = 0; 
 for (int j = 0; j <= n; j++) c[0][j] = 0;
 
 for (int i = 1; i <= m; i++) {
  for (int j = 1; j <= n; j++) {
   if (X[i] == Y[j]) {
    c[i][j] = c[i - 1][j - 1] + 1;
    } else if (c[i - 1][j] < c[i][j-1]){
     c[i][j] = c[i][j-1];
    } else {
      c[i][j] = c[i-1][j];
   }
  if (maxl < c[i][j]) {
      maxl = c[i][j];
  }
      
  }
}
 
return maxl;
}
 
int main() {
string s1, s2;
int n; cin >> n;
for (int i = 0; i < n; i++){
cin >> s1 >> s2;
cout << lcs(s1, s2) << endl;
}
return 0;
}


Measured memory_bytes: 6944
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

ll a[100000];
int b[100000];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ll mi = 1e9, sum = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        b[i] = a[i] < 0;
        sum += abs(a[i]);
        mi = min(mi, abs(a[i]));
    }
    for (int i = 0; i < n - 1; ++i)
        if (b[i])
            b[i] ^= 1, b[i + 1] ^= 1;

    if (b[n - 1])
        cout << sum - 2 * mi;
    else
        cout << sum;
}


Measured memory_bytes: 1408
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(N)];
        int a = 0;
        for(int i = 0 ; i < N ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
       
        int[] B = new int[(int)(M)];
        int h = 0;
        for(int i = 0; i < M;i++){
            B[i] = 0;
            for(int n = 0; n < N ; n++){
                if(B[i] < A[n]){
                    B[i] = A[n];
                    h = n;
                }
            }
            A[h] = 0;
        }
        

        if((double)a/(4.0*M) > (double)B[M-1]){
        System.out.print("No");
        }else{
            System.out.print("Yes");
            }
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int k,t;
  cin>>k>>t;
  int a[100];
  int sum=0;
  rep(i,t){cin>>a[i];sum+=a[i];}
  sort(a,a+t);
  cout<<max(a[t-1]-1-(k-a[t-1]),(int)0)<<endl;

  return 0;
}


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

int main(){
  int a,b,x;
  cin>>a>>b>>x;
  if(a<=x && a+b>=x) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
D - Digits Parade
https://atcoder.jp/contests/abc135/tasks/abc135_d

"""
import sys


def solve(S):
    dp = [[0] * 13 for _ in range(len(S)+1)]
    dp[0][0] = 1
    for i, ch in enumerate(S):
        for j in range(10):
            if ch == '?' or j == int(ch):
                for ki in range(13):
                    dp[i+1][(ki*10 + j) % 13] += dp[i][ki]
        for j in range(13):
            dp[i+1][j] %= (10**9 + 7)
    return dp[len(S)][5]


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

int main()
{
	string S;
    cin >> S;
	int x = 0;
	for (int i = 0; i < 4; i++) {
		if (S[i] == '+') x++;
		else x--;
	}
	cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i, k;
    cin >> n >> k;
    vll a(n + 1);
    for(i = 1; i <= n; i++)
        cin >> a[i];
    vll vis(n + 1, -1);
    ll cur = 1, step = 0, p = n;
    vis[1] = 0;
    for(i = 1; i <= n; i++)
    {
        if(vis[a[cur]] == -1)
        {
            cur = a[cur];
            vis[cur] = i;
        }
        else
        {
            p = i - vis[a[cur]];
            step = vis[a[cur]];
            break;
        }
    }
    // cout << step << ' ' << p << endl;
    cur = 1;
    for(i = 1; i <= min(step, k); i++)
        cur = a[cur];
    k = (step > k ? 0 : (k - step) % p);
    for(i = 0; i < k; i++)
        cur = a[cur];
    cout << cur << endl;
    return 0;
}

Measured memory_bytes: 6364
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include <ios>
#include <iomanip>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef tuple<ll,ll,ll> Tl;

bool mycompare( const Tl &lhs, const Tl &rhs )
{
    return std::get<2>(lhs) < std::get<2>(rhs);
}

int atcoder(){
    //入力
    int n,m;
    cin >> n >> m;
    vector<Tl> vt;
    REP(i,0,m){
        ll p,y;
        cin >> p >> y;
        vt.emplace_back(p,y,i);
    }
    
    //処理
    sort(begin(vt),end(vt));
    ll tmp = 1;
    REP(i,0,m){
        get<1>(vt[i]) = tmp;
        if(get<0>(vt[i])==get<0>(vt[i+1])) tmp++;
        else tmp = 1;
    }
    sort(begin(vt),end(vt),mycompare);

    //出力
    REP(i,0,m){
        cout << setfill('0') << right << setw(6) << get<0>(vt[i]);
        cout << setfill('0') << right << setw(6) << get<1>(vt[i]) << ENT;
    }
    return 0;
}

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


Measured memory_bytes: 4852
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    ll n,x;
    IN n >> x;
    ll a[100005] = {};
    inrep(n,a);

    ll ans = 0;
    rep(i,0,n-1){
        if(a[i] + a[i+1] > x){
            ans += (a[i] + a[i+1]) - x;
            a[i+1] = max(0LL, a[i+1] - ((a[i] + a[i+1]) - x));
        }
    }
    P(ans);
    
	return  0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MOD = 1e9 + 7;

ll mypow(ll n, ll p) {
    if (p < 0) return 0;
    if (p == 0) return 1;
    else if (p & 1) {
        return n * mypow(n, p - 1) % MOD;
    } else {
        ll half = mypow(n, p >> 1) % MOD;
        return (half * half) % MOD;
    }
}

int main() {
    string s;
    cin >> s;
    vector<ll> a(s.length());
    vector<ll> c(s.length());
    vector<ll> ql(s.length());
    vector<ll> qr(s.length());
    for (int i = 0; i < s.length() - 2; ++i) {
        if (s[i] == 'A') a[i + 1] = a[i] + 1;
        else a[i + 1] = a[i];
        if (s[i] == '?') ql[i + 1] = ql[i] + 1;
        else ql[i + 1] = ql[i];
    }
    for (int i = s.length() - 1; i > 1; --i) {
        if (s[i] == 'C') c[i - 1] = c[i] + 1;
        else c[i - 1] = c[i];
        if (s[i] == '?') qr[i - 1] = qr[i] + 1;
        else qr[i - 1] = qr[i];
    }

    ll ans = 0;
//    for (int i = 1; i < s.length() - 1; ++i) {
//        cout << a[i] << " ";
//    }
//    cout << endl;
//    for (int i = 1; i < s.length() - 1; ++i) {
//        cout << c[i] << " ";
//    }
//    cout << endl;
    for (int i = 1; i < s.length() - 1; ++i) {
        if (s[i] == 'B' || s[i] == '?') {
            ans += (((a[i] * c[i]) % MOD) * (mypow(3, ql[i]) % MOD * mypow(3, qr[i]) % MOD) % MOD);
            ans %= MOD;
            ans += (a[i] * mypow(3, ql[i]) % MOD) * (qr[i] * mypow(3, qr[i] - 1) % MOD) % MOD;
            ans %= MOD;
            ans += (c[i] * mypow(3, ql[i] - 1) % MOD) * (ql[i] * mypow(3, qr[i]) % MOD) % MOD;
            ans %= MOD;
            ans += (ql[i] * qr[i]) % MOD * (mypow(3, ql[i] - 1) * mypow(3, qr[i] - 1) % MOD) % MOD;
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define SIZE 105
using namespace std;

char mp[SIZE][SIZE];
int dp[SIZE][SIZE];

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++) scanf("%s",&mp[i]);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(i==0&&j==0) dp[i][j]=(mp[i][j]=='.'?0:1);
			else
			{
				int w=n+m;
				if(i>0) w=min(w,dp[i-1][j]+(mp[i-1][j]!=mp[i][j]));
				if(j>0) w=min(w,dp[i][j-1]+(mp[i][j-1]!=mp[i][j]));
				dp[i][j]=w;
			}
		}
	}
	printf("%d\n",(dp[n-1][m-1]+1)/2);
	return 0;
}

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

using namespace std;

int main() {
	string S;
	cin >> S;
	
	long l=S.size();
	long count=0;
	for(long i=1; i<l; ++i){
		if(S[i-1]!=S[i])count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 512
from collections import Counter
S = [int(c) for c in input()]
N = len(S)
ls = [0]*N
m = 1
for i in range(N):
  ls[N-1-i] = S[N-1-i]*m%2019
  m *= 10
  m %= 2019
T = [0]*N
T[0] = ls[0]
for i in range(1,N):
  T[i] = (T[i-1]+ls[i])%2019
c = Counter(T)
ans = c[0]+sum(v*(v-1)//2 for v in c.values())
print(ans)

Measured memory_bytes: 80600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    string s;
    cin>>a>>b>>s;
    bool flag=true;
    for(int i=0; i<a+b+1; i++)
    {
        if(i==a && s[i]!='-')
        {
            flag=false;
            break;
        }
        if(i!=a)
        {
            if(s[i]>='0'&&s[i]<='9')
                flag=true;
            else
            {
                flag=false;
                break;
            }
        }
    }
    if(flag)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(n: int, v: "List[int]"):
    from collections import Counter
    a = Counter(v[::2]).most_common()
    b = Counter(v[1::2]).most_common()
    if a[0][0] != b[0][0]:
        return n - a[0][1] - b[0][1]
    a = a + [(0, 0)]
    b = b + [(0, 0)]
    return n - max(a[0][1] + b[1][1],
                   a[1][1] + b[0][1])


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    v = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    print(solve(n, v))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 27536
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  int r,g,b,n;
  cin>>r>>g>>b>>n;
  int ans=0;
  for(int i=0;i<=n/r;i++){
    int m=n-r*i;
    for(int j=0;j<=m/g;j++){
      if((m-j*g)%b==0){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define all(a) a.begin(),a.end()
#define mod 1000000007
#define pi 3.141592653589
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod) ;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T>
// using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
//(*****FOR USING ORDERED SET CHANGE INT*******)

const int maxN = 101 ;
int N, W ;
int w[maxN], v[maxN] ;
int dp[maxN][100001] ;

int solve(int ind, int wt) {
    if(ind == N)
        return 0 ;
    if(dp[ind][wt] != -1)
        return dp[ind][wt] ;
    int ans = solve(ind+1, wt) ;
    if(wt+w[ind] <= W) {
        ans = max(ans, solve(ind+1, wt+w[ind])+v[ind]) ;
    }
    return dp[ind][wt] = ans ;
}

signed main() {
    quickie
    cin >> N >> W ;
    memset(dp, -1, sizeof(dp)) ;
    rep(i, 0, N) {
        cin >> w[i] >> v[i] ;
    }
    int ans = solve(0, 0) ;
    cout << ans << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 82548
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	a, z := -1, -1
	for i := 0; i < len(s); i++ {
		if a == -1 && s[i] == 'A' {
			a = i
		}
		if a != -1 && s[i] == 'Z' {
			z = i
		}
	}
	fmt.Println(z - a + 1)
}


Measured memory_bytes: 1920
import sys

N,Y = map(int,sys.stdin.readline().split(' '))

result = [-1] * 3

for x in range(N+1):
    for y in range(N-x+1):
        if (10000*x + 5000*y + 1000*(N-x-y)) == Y and (N-x-y) >= 0:
            result = [x,y,N-x-y]
            break

print(*result)

Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false); //cin.tie(NULL); cout.tie(NULL)
#define mp make_pair
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef long double ld;


/* BIEN CUC BO BEGIN*/
	ll n, m;
/* BIEN CUC BO END*/

void solve(){	
	cin >> n >> m;
	cout << fixed << setprecision(5) << (ld)n/m;
}	

int main(){ FIO;
	solve();
return 0;}

Measured memory_bytes: 256
n,m = map(int,input().split())
a = [0]*(m+1)
for i in range(n):
	k, *s = map(int, input().split())
	for _ in range(k):
		a[s[_]] += 1
ans = 0
for i in range(m+1):
	if a[i] == n:
		ans += 1
print(ans)

Measured memory_bytes: 3060
#include <stdio.h> 
#include <ctype.h> 
#include <stdlib.h>
int main() {
int a[101][101], b[101][101];
long long c[101][101], s;
int i, j, k;
int n, m, l;
scanf("%d%d%d", &n, &m, &l);
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
}
for (i = 0; i < m; i++) {
for (j = 0; j < l; j++) scanf("%d", &b[i][j]);
}
for (i = 0; i < n; i++) {
for (j = 0; j < l; j++) {
s = 0;
for (k = 0; k < m; k++) {
s += a[i][k] * b[k][j];
}
c[i][j] = s;
}
}
for (i = 0; i < n; i++) {
printf("%lld", c[i][0]);
for (j = 1; j < l; j++) printf(" %lld", c[i][j]);
putchar('\n');
}
return 0;
}


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

int main() {
  ll n;
  cin >>n;
  ll ans=1;
  map<ll,ll>fac;
  for(ll ni=2;ni<=n;ni++){
    int ntmp=ni;
  	for(ll i=2;i*i<=ntmp;i++){
    	if(ntmp%i!=0)continue;
    	while(ntmp%i==0){
      		if(fac.count(i)){
      			ntmp/=i;
              	fac.at(i)++;
            }
          	else{fac[i]=1;}
    	}
  	}
  	if(ntmp!=1){
      if(fac.count(ntmp)){
              	fac.at(ntmp)++;
            }
          	else{fac[ntmp]=1;}
    }
  }
  for(auto f:fac){
    ans*=(f.second+1);
    ans%=1000000007;
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 3580
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int n, m, K, Num[60], cnt, Up[60], Ch[60][60];
int C, D[60], D2[60], Root[60];
long long Mod = 1000000007, po[110];
vector<int>E[60];
void DFS(int a){
    int i, x;
    Num[a] = ++cnt;
    Up[a] = cnt;
    for(i=0;i<E[a].size();i++){
        x = E[a][i];
        if(Num[x]){
            Up[a] = min(Up[a], Num[x]);
            continue;
        }
        Ch[a][x] = 1;
        DFS(x);
        Up[a] = min(Up[a], Up[x]);
        if(Up[x] >= Num[a]){
            Ch[a][x] = 2;
        }
    }
}
void Do(int a, int pp, int c){
    int i, x;
    for(i=0;i<E[a].size();i++){
        x = E[a][i];
        if(x==pp)continue;
        if(Num[x] < Num[a]){
            D2[c]++;
            continue;
        }
        if(!Ch[a][x])continue;
        if(Ch[a][x] == 1){
            D[c]++,D2[c]++;
            Do(x, a, c);
        }
        else{
            C++;
            D[C]=2,D2[C] = 1;
            Do(x, a, C);
        }
    }
}
int gcd(int a, int b){
    return b?gcd(b,a%b):a;
}
long long Inv(long long a){
    int b = Mod-2;
    long long r = 1;
    while(b){
        if(b&1)r=r*a%Mod;
        a=a*a%Mod;b>>=1;
    }
    return r;
}
int main(){
    int i, a, b, j;
    long long res = 1;
    scanf("%d%d%d",&n,&m,&K);
    for(i=0;i<m;i++){
        scanf("%d%d",&a,&b);
        E[a].push_back(b);
        E[b].push_back(a);
    }
    po[0]=1;
    for(i=1;i<=100;i++){
        po[i]=po[i-1]*K%Mod;
    }
    for(i=1;i<=n;i++){
        if(!Num[i]){
            DFS(i);
            Root[i] = 1;
        }
    }
    for(i=1;i<=n;i++){
        if(Root[i]){
            Do(i,-1,0);
        }
    }
    for(i=1;i<=C;i++){
        if(D2[i] == D[i] - 1){
            res = res * po[D2[i]] % Mod;
            continue;
        }
        if(D2[i] != D[i]){
            for(j=1;j<=D2[i];j++){
                res = res * (K-1+j)%Mod;
                res = res * Inv(j)%Mod;
            }
        }
        else{
            long long s = 0;
            for(j=1;j<=D[i];j++){
                s = (s+po[gcd(j,D[i])])%Mod;
            }
            s = s * Inv(D[i])%Mod;
            res = res * s %Mod;
        }
    }
    printf("%lld\n",res);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()

class modfact(object):
    def __init__(self,n):
        fact=[1]*(n+1); invfact=[1]*(n+1)
        for i in range(1,n+1): fact[i]=i*fact[i-1]%MOD
        invfact[n]=pow(fact[n],MOD-2,MOD)
        for i in range(n-1,-1,-1): invfact[i]=invfact[i+1]*(i+1)%MOD
        self.__fact=fact; self.__invfact=invfact

    def inv(self,n):
        assert(n>0)
        return self.__fact[n-1]*self.__invfact[n]%MOD

    def fact(self,n):
        return self.__fact[n]

    def invfact(self,n):
        return self.__invfact[n]

    def comb(self,n,k):
        if(k<0 or n<k): return 0
        return self.__fact[n]*self.__invfact[k]*self.__invfact[n-k]%MOD

    def perm(self,n,k):
        if(k<0 or n<k): return 0
        return self.__fact[n]*self.__invfact[n-k]%MOD

def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    mf=modfact(n)

    # max
    M=0
    A.sort()
    for i in range(n):
        # a[i]を選び、残り0,...,i-1 から k-1 個選ぶ
        M+=A[i]*mf.comb(i,k-1)
        M%=MOD

    # min
    m=0
    A.sort(reverse=1)
    for i in range(n):
        m+=A[i]*mf.comb(i,k-1)
        m%=MOD

    print((M-m)%MOD)
resolve()

Measured memory_bytes: 63728
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
typedef long long ll;
const ll mod=1000000007;

int main(int argc, char const *argv[])
{
	int n;
	string s[2];
	while(cin>>n){
		cin>>s[0]>>s[1];
		ll ans=1;
		int i=0;
		int kind=0;
		while(i<n){
			if(s[0][i]==s[1][i]){
				if(i==0){
					ans=(ans*3)%mod;
				}
				else{
					if(kind==1)
						ans=(ans*2)%mod;
					else if(kind==2)
						ans=(ans)%mod;
				}
				i++;
				kind=1;
			}
			else if(s[0][i]==s[0][i+1]){
				if(i==0){
					ans=(ans*6)%mod;
				}
				else{
					if(kind==1){
						ans=(ans*2)%mod;
					}
					else if(kind==2){
						ans=(ans*3)%mod;
					}
				}
				i+=2;
				kind=2;
			}
		}
		printf("%lld\n",ans);
	}	
	return 0;
}

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

int main(){
  long n,i,j,a,div=1,ans=1000;
  cin >> n; a=n;
  for(i=0; i<11; i++){
    if(a/div < 1000){
      break;
    }
    div*=10;
  }
  while(div>0){
    ans=min(ans,abs((n/div)%1000-753));
    div/=10;
  }
  cout << ans;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();

        if (c > b && b > a) {
            System.out.println("Yes");
            return;
        }

        for (int i = 0; i <= k; i++) {
            for (int j = 0; i+j <= k; j++) {
                int b2 = b * (int)Math.pow(2,i);
                int c2 = c * (int)Math.pow(2,j);
                if (c2 > b2 && b2 > a) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }
}


Measured memory_bytes: 35792
#include <stdio.h>
#include <ctype.h>

int main(void) {
  char ch;

  while ((ch = getchar()) != EOF) {
    if (ch >= 65 && ch <= 90)
      ch = tolower(ch);
    else if (ch >= 97 && ch <= 122)
      ch = toupper(ch);

    putchar(ch);
  }
  

  
  return 0;
}


Measured memory_bytes: 2084
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	int a = read.to!int;
	int b = read.to!int;
	
	string ans;
	if(a <= 8 && b <= 8) ans = "Yay!";
	else ans = ":(";
	
	ans.writeln;
	}

Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

uint32_t N;
uint32_t H[200000];

int main(void) {
	uint32_t i;
	uint32_t answer = 0, start = 0;
	if (scanf("%" SCNu32, &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%" SCNu32, &H[i]) != 1) return 1;
	}
	H[N] = UINT32_MAX; /* banhei */
	for (i = 1; i <= N; i++) {
		if (H[i - 1] < H[i]) {
			if (i - start > answer) answer = i - start;
			start = i;
		}
	}
	printf("%" PRIu32 "\n", answer - 1); /* masu no kazu ga deru node idou kaisuu wa -1 */
	return 0;
}


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

int N;
set<char> hina;

int main(){
    scanf("%d", &N);
    char arare;
    bool y=false;
    for(int i = 0; i<N; i++){
        scanf("%c", &arare);
        if(arare == 'Y'){y= true; break;} 
    }
    if(y) printf("Four\n");
    else printf("Three\n");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<unordered_map>
using namespace std;
#define int long long
typedef long double ld;
const long double pi= 3.14159265358979323846264338327950288;
int a[1000001], n, sum = 0, c = 0;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum % ((1 + n)*n / 2) != 0) {
		cout << "NO\n";
		return 0;
	}
	bool l = true;
	sum = sum / ((1 + n)*n / 2);
	for (int i = 0; i < n - 1; i++) {
		int b = (a[i + 1] - a[i] - sum);
		if (b>0&&b%n != 0) {
			l = false;
		}
		else
			c += abs(b / n);
	}
	if ((a[0] - a[n - 1] - sum)>0&&(a[0] - a[n - 1] - sum) % n != 0) l = false;
	else
		c += abs(((a[0] - a[n - 1] - sum) / n));
	if (c == sum&&l) {
		cout << "YES\n";
		cin >> n;
	}
	else {
		cout << "NO\n";
		return 0;
	}
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
signed main()
{
	cin>>s;
	n=s.size();
	for(int i=0;i<n/2;i++)
	if(s[i]!=s[n-i-1])
	{
		cout<<"No";
		return 0;
	}
	for(int i=0;i<(n-1)/2;i++)
	if(s[i]!=s[(n-1)/2-i-1])
	{
		cout<<"No";
		return 0;
	}
	for(int i=(n+1)/2;i<n;i++)
	if(s[i]!=s[n+(n+1)/2-i-1])
	{
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int n; unsigned long h, w; cin >> n >> h >> w;
    unsigned long a, b; int c=0;
    for(int i=0;i<n;++i) {
        cin >> a >> b;
        if(a>=h && b>=w) ++c;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        if (k < 10) {
            System.out.println(k);
            return;
        }
        Queue<Long> queue = new ArrayDeque<>();
        for (int i = 1 ; i < 10 ; i++) {
            queue.add((long) i);
        }
        for (int i = 0 ; i < k ; i++) {
            long x = queue.remove();
            if (i == k - 1) {
                System.out.println(x);
            }
            if (x % 10 != 0) {
                queue.add(10 * x + x % 10 - 1);
            }
            queue.add(10 * x + x % 10);
            if (x % 10 != 9) {
                queue.add(10 * x + (x % 10) + 1);
            }
        }


    }

}

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

int main() {

	ll a, b, k; cin >> a >> b >> k;

	ll n = max(a, b);
	vector<ll> p;
	
	for (ll i = 1; i <= n; i++) {	
		if (a % i == 0 && b % i == 0){
			p.emplace_back(i);
		}	
	}

	sort(p.begin(), p.end(), greater<ll>());

	cout << p[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for(int i = x; i < n; i++)

char c;

int main(void){
    cin >> c;
    cout << (char)(c + 1);
}
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < (n);i++)
#define lint long long
const lint mod=1e9+7;
const lint inf=2.19e15+1;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}

signed main(){
    int n, k;
    cin >> n >> k;
    vector<int>a(n);
    REP(i, n){
        cin >> a[i];
        if (i >= k){
            if (a[i] > a[i - k]){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
        }
    }
}


Measured memory_bytes: 3992
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	int h;
	int n;
	cin>>h>>n;
	rb(i,1,n){
		int ai;cin>>ai;
		h-=ai;
	}
	if(h<=0){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

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

void swap(int x,int y){
    int tmp = x;
    x = y;
    y = tmp;
}

long gcd(int a, int b){
    if(a<b) swap(a,b);
    if (b == 0) return a;
    return gcd(b, a%b);
}
long gcd3(int a, int b, int c){
    return gcd(a,gcd(b,c));
}

int main(){
    int K = 0;
    scanf("%d",&K);
    long ans = 0;
    for(int a = 1; a <= K; a++){
        for(int b = 1; b <= K; b++){
            for(int c = 1; c <= K; c++){
                ans+=gcd3(a,b,c);
            }
        }
    }
    printf("%ld\n",ans);
    return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
int main(){
   long int n,a,b,c,d=0;
   cin>>n;
   a=n%10;
   b=(n/10)%10;
   c=(n/100)%10;
   if(a==1)d++;
   if(b==1)d++;
   if(c==1)d++;
   cout<<d<<endl;
}



Measured memory_bytes: 256
def main():
 h, w = map(int, input().split())
 a = [input() for _ in range(h)]
 na = []
 l = [0] * (w + 1)
 for i in range(h):
  if not("#" in a[i]):
   pass
  else:
   na += [a[i]]
   for j in range(w):
    if a[i][j] == "#":
     l[j] += 1
 for i in na:
  for j in range(w):
   if l[j] != 0:
    print(i[j], end="")
  print("")
main()

Measured memory_bytes: 4468
using System;
using System.Collections.Generic;
using System.Linq;
class Program
    {
        static void Main(string[] args)
        {   
            int n = int.Parse(Console.ReadLine());
            int[][] tasks = new int[n][];
            for (int i=0; i<n; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                tasks[i] = new int[2];
                tasks[i][0] = int.Parse(s[0]);
                tasks[i][1] = int.Parse(s[1]);
            }

            Array.Sort(tasks, (a, b) => a[1] - b[1]);

            int time = 0;
            for (int i=0; i<n; i++)
            {
                time += tasks[i][0];
                if (time > tasks[i][1])
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
            
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 26148
#include <iostream>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int H, W;
while (cin >> H >> W && (H > 0 || W > 0)) {
for (int i = 0; i < H; i++) {
 for (int j = 0; j < W; j++) {
     if (i == 0 || i == H-1 || j == 0 || j == W-1)
         cout << "#";
     else
         cout << ".";
 }
 cout << "\n";
}
cout << "\n";
}
}

Measured memory_bytes: 3100
def main():
    w, h, n = map(int, input().split())
    
    w_min, w_max = [0], [w]
    h_min, h_max = [0], [h]
    
    for i in range(n):
        x, y, a = map(int, input().split())
        if a == 1:
            w_min.append(x)
        elif a == 2:
            w_max.append(x)
        elif a == 3:
            h_min.append(y)
        else:
            h_max.append(y)
            
    w = min(w_max) - max(w_min)
    h = min(h_max) - max(h_min)
    
    if w > 0 and h > 0:
        print(w*h)
    else:
        print(0)

        
if __name__ == "__main__":
    main()


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

using namespace std;

int main() {
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    int c;
    cin >> c;
    vector<int> d(n);
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }
    sort(d.rbegin(), d.rend());
    int now = c;
    int value = now / a;
    for (int i = 0; i < n; ++i) {
        now += d[i];
        if (now / (a + (i + 1) * b) >= value) {
            value = now / (a + (i + 1) * b);
        } else {
            break;
        }
    }
    cout << value << '\n';
}


Measured memory_bytes: 3044
#include <stdio.h>

int main(void) 
{
	unsigned int a, b;
	int d, r;
	double f;

	scanf("%d %d", &a, &b);
	
	d = a/b;
	r = a%b;
	f = (double)a/(double)b;
	
	printf("%d %d %f\n", d, r, f);
	
	return 0;
}

Measured memory_bytes: 636
S=input()
K=int(input())
flag=0
c=0
for i in (S):
    if int(i)!=1:
        print(i)
        flag=1
        break
    else:
        c+=1
        if c>=K:
            print(1)
            flag=1
            break

if flag==0:
    print(1)


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

int a[100010],b[100010];

int main(){
	int i,j,m,n,t = 0,k = 0,ans = 0;
	string s;
	cin >> s;
	for(i=0;i<=s.length()-1;i++){
		k++;
		a[k] = (int)s[i]-48;
		b[k] = a[k];
	}
//	for(i=1;i<=k;i++){
//		printf("%d %d\n",a[i],b[i]);
//	}
	for(i=1;i<=k;i++){
		if(i%2==0){
			if(a[i]==1)ans++;
			else t++;
		}
		else{
			if(a[i]==0)ans++;
			else t++;
		}
	}
	printf("%d",min(t,ans));
	return 0;
} 

Measured memory_bytes: 1280
N, M = [int(i) for i in input().split()]
edge = dict()
for i in range(1,N+1):
    edge[i] = set()
for i in range(M):
    a, b = [int(i) for i in input().split()]
    edge[a].add(b)
    edge[b].add(a)
c = edge[1].intersection(edge[N])
if len(c) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 89180
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC086AProduct {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            out.println(in.nextInt() * in.nextInt() % 2 == 0 ? "Even" : "Odd");
        }

    }
}



Measured memory_bytes: 22868
/**
 * Title:
 * Url:
 */
#include<iostream>

using namespace std;

#define ll long long

ll gcd(ll a, ll b) {
    if(a==b) return a;
    if(a<b) {
        ll tmp = a;
        a = b;
        b = tmp;
    }
    ll r = a%b;
    while(r!=0) {
        ll tmp_r = r;
        r = b % r;
        b = tmp_r;
    }
    return b;
}

// 最小公倍数
ll lcm(ll a, ll b) {
    if(a==b) {
        return a;
    }
    ll gcd_a_b = gcd(a, b);
    return a/gcd_a_b*b;
}

int main() {
    ll k; cin >> k;
    ll sum = 0;
    for(ll i=1; i<=k; i++) {
        for(ll j=1; j<=k; j++) {
            for(ll l=1; l<=k; l++) {
                sum += gcd(gcd(i, j), l);
            }
        }
    }
    cout << sum << endl;

    return 0;
}

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

#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

#define MAX_N 100000

struct Card {
  char suit;
  int value;
};

Card A[MAX_N + 5];

int partition(int p, int r) {
  int x = A[r].value;
  int i = p - 1;
  Card tmp;
  for (int j = p; j < r; j++) {
    if (A[j].value <= x) {
      i++;
      tmp = A[j];
      A[j] = A[i];
      A[i] = tmp;
    }
  }
  tmp = A[r];
  A[r] = A[i + 1];
  A[i + 1] = tmp;
  return i + 1;
}

void quickSort(int p, int r) {
  if (p < r) {
    int q = partition(p, r);
    quickSort(p, q - 1);
    quickSort(q + 1, r);
  }
}

int main() {
  int n;
  cin >> n;
  rep(i, n) {
    char suit;
    int value;
    cin >> suit >> value;
    Card c = {suit, value};
    A[i] = c;
  }
  map<int, vector<char>> bmp;
  rep(i, n) {
    if (bmp.count(A[i].value)) {
      bmp[A[i].value].push_back(A[i].suit);
    } else {
      vector<char> v = {A[i].suit};
      bmp[A[i].value] = v;
    }
  }
  quickSort(0, n - 1);
  map<int, vector<char>> amp;
  rep(i, n) {
    if (amp.count(A[i].value)) {
      amp[A[i].value].push_back(A[i].suit);
    } else {
      vector<char> v = {A[i].suit};
      amp[A[i].value] = v;
    }
  }

  bool stable = true;
  for (auto i = bmp.begin(); i != bmp.end(); i++) {
    int key = i->first;
    vector<char> bv = i->second;
    vector<char> av = amp[key];
    rep(i, bv.size()) {
      if (av[i] != bv[i]) {
        stable = false;
      }
    }
    if (!stable) break;
  }
  if (stable) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
  rep(i, n) cout << A[i].suit << " " << A[i].value << endl;
  return 0;
}



Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    vector<ll> fact(2005);
    fact[0] = 1; fact[1] = 1;
    for (int i = 2; i < 2005; i++) {
        fact[i] = fact[i-1] * i % MOD;
    }

    vector<ll> inv(2005); inv[1] = 1;
    for (int i = 2; i < 2005; i++) {
        inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
    }

    vector<ll> invfact(2005);
    invfact[0] = 1; invfact[1] = 1;
    for (int i = 2; i < 2005; i++) {
        invfact[i] = invfact[i-1] * inv[i] % MOD;
    }       

    ll N, K; cin >> N >> K;

    ll tmp;
    for (ll i = 1; i <= K; i++) {
        if(N-K+1 < i){
            printf("0\n"); continue;
        }
        if(K < i){
            printf("0\n"); continue;
        }
        tmp = fact[N-K+1] * invfact[i] % MOD;
        tmp = tmp * invfact[N-K-i+1] % MOD;
        tmp = tmp * fact[K-1] % MOD;
        tmp = tmp * invfact[i-1] % MOD;
        tmp = tmp * invfact[K-i] % MOD;
        printf("%lld\n", tmp % MOD);
    }

}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!


#a,b,c=[int(i) for i in input().split()]


s = input()

st = []


for i in s:
    if len(st) == 0 or st[-1] == i:
        st.append(i)
    else: st.pop()

print(len(s) - len(st))


Measured memory_bytes: 3956
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(){
	int a, b;
	cin >> a >> b;

	int res = 0;
	if (b == 1) {
		cout << 0;
		return 0;
	}
	if (a >= b) {
		cout << 1;
		return 0;
	}
	int c = (b-a) / (a-1);
	if ((b-a)%(a-1) == 0) {
		cout << c + 1;
		return 0;
	}
	cout << c + 2;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX=200001;
typedef pair<int,int> P;
int main()
{
  int n,m,i;
  P b[N_MAX]; // 枝データ
  int c[N_MAX]; // 頂点iの属する集合番号
  int nc[N_MAX]; // 集合jの要素数
  int pc[N_MAX]; // 集合jの先頭の要素番号
  int pi[N_MAX]; // 頂点iと同じ集合の要素へのポインタ
  int res=0;
  int i1,i2,s1,s2,p,pt;
  cin >> n >> m;
  for(i=0;i<m;i++)
    cin >> b[i].first >> b[i].second;
  for(i=1;i<=n;i++){
    c[i]=i;
    nc[i]=1;
    pc[i]=i;
    pi[i]=0;
  }
  for(i=0;i<m;i++){
    i1=b[i].first;
    i2=b[i].second;
    if(c[i1]!=c[i2]){
// 集合のマージここから
      s1=c[i1]; s2=c[i2];
      if(nc[s1]<nc[s2]){// 小さい方を潰す【重要】
        s1=c[i2]; s2=c[i1];
      }
      pt=pc[s1];
      p=pc[s2];
      pc[s1]=p;
      nc[s1]+=nc[s2];
      pc[s2]=0;
      nc[s2]=0;
      while(true){
        c[p]=s1;
        if(pi[p]==0) break;
        p=pi[p];
      }
      pi[p]=pt;
// 集合のマージここまで
    }
  }
  for(i=1;i<=n;i++)
    res=max(res,nc[c[i]]);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 8276
#include<bits/stdc++.h>
#define gc getchar
#define re register
#define rep(i,u,z) for(re int i=u;i<=z;++i)
#define reb(i,u,z) for(re int i=u;i>=z;--i)
#define inf 0x7fffffff

using namespace std;
typedef long long ll;

ll W,H,x,y;

inline int read(){
	int rt=0;
	char ch=gc();
	while(ch<'0'||ch>'9')ch=gc();
	while(ch>='0'&&ch<='9'){
		rt=(rt<<3)+(rt<<1)+(ch&15);
		ch=gc();
	}
	return rt;
}
int main(){
	W=read(),H=read(),x=read(),y=read();
	double ans1=1.000000000*W*H/2.000000000;
	printf("%.10f ",ans1);
	if((W%2)|(H%2))putchar('0');
	else if(x==W/2&&y==H/2)putchar('1');
	else putchar('0');
	return 0;
}

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


using namespace std;



int main() {

	int N, M, *city, a, b;

	cin >> N >> M;
	
	city = new int[N];

	for (int i = 0; i < N; i++) {
		city[i] = 0;
	}

	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		city[a - 1]++;
		city[b - 1]++;
	}

	for (int i = 0; i < N; i++) {
		cout << city[i] << "\n";
	}

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>

int main()
{
  int n, a, b, c;
  scanf("%d%d%d%d", &n, &a, &b, &c);
  int l[8];
  for (int i = 0; i < n; ++i)
  {
    scanf("%d", l + i);
  }
  int lim = 1 << (n * 2);
  int ans = 1e9;
  for (int i = 0; i < lim; ++i)
  {
    int x = 0, y = 0, z = 0;
    int mp = 0;
    for (int j = 0; j < n; ++j)
    {
      switch ((i >> (j * 2)) & 3)
      {
        case 1:
          mp += 10;
          x += l[j];
          break;
        case 2:
          mp += 10;
          y += l[j];
          break;
        case 3:
          mp += 10;
          z += l[j];
          break;
      }
    }
    if (x == 0 || y == 0 || z == 0) continue;
    mp += std::abs(x - a) + std::abs(y - b) + std::abs(z - c) - 30;
    if (mp < ans) ans = mp;
  }
  printf("%d\n", ans);
  return 0;
}

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

#define rep(i,n) for (int i=0; i< (n); i++)
typedef std::pair<int, int> P;
typedef long long int ll;

using namespace std;

const int INF = 1001001001;
int dist[100005][3];

int main(){
    int n, m;
    std::cin >> n >> m;
    vector<vector<int>> to(n);

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
    }
    int sv, tv;
    cin >> sv >> tv;
    --sv; --tv;
    rep(i, n)rep(j, 3)dist[i][j] = INF;
    queue<P> q;
    q.push(P(sv, 0));
    dist[sv][0] = 0;
    while (!q.empty()) {
        int v = q.front().first;
        int l = q.front().second;
        q.pop();
        for (int u : to[v]){
            int nl = (l+1)%3;
            if(dist[u][nl] == INF){
                dist[u][nl] = dist[v][l] + 1;
                q.push(P(u, nl));
            }
        }
    }
    int ans = dist[tv][0];
    if(ans == INF)ans = -1;
    else ans /= 3;
    cout << ans << endl;
    return 0;
}

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

using ll = long long;

ll X, Y, Z;

void solve(){
    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z;
}
int main(){
    cin >> X >> Y >> Z;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

const int MOD = 1000000007;

int main() {
	int n; cin >> n;
	vector<long long> a(n);
	for (long long& e : a) cin >> e;
	vector<long long> t(n);
	t[n - 1] = a[n - 1];
	for (int i = n - 1; i > 0; --i)
		t[i - 1] = (t[i] + a[i - 1]) % MOD;
	long long ans = 0;
	for (int i = 1; i < n; ++i)
		(ans += a[i - 1] * t[i] % MOD) %= MOD;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6424