akhauriyash/Code-Regression huggingface dataset:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("GREATER")
    elif (x<y): print("LESS")
    else: print("EQUAL")

def ip():
    return int(input())


def calculate(a):
    s = 0
    for i in range(len(a)):
        for k in range(i+1,len(a)):
            s+=(a[i]*a[k])
    return s

#n = ip()                                     #入力整数1つ
n,x= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s = abs(a[0]-x)
for i in range(1,n):
    s = fractions.gcd(s,abs(a[i]-x))
print(s)

Measured memory_bytes: 24048
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
 
int main() {
    ios::sync_with_stdio(false);
    int n, k, a[100005] = {}, z = mod;
    cin >> n >> k; k--;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    for (int i = k; i < n; i++) z = min(z, a[i] - a[i - k]);
    cout << z;
}


Measured memory_bytes: 640
n,k,q=map(int,input().split())
l=[-q for i in range(n)]
for i in range(q):
  m=int(input())
  l[m-1]=l[m-1]+1
for i in range(n):
  l[i]+=k
for i in range(n):
  if l[i]>0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 7848
#include "bits/stdc++.h"

using namespace std;

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

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int ret = 1, st = 0;
    if (s[0] == '0')
        k--;
    for (int i = 1; i < n; i++)
    {
        if (s[i] == '0' && s[i - 1] != '0')
            k--;
        while (k < 0)
        {
            if (s[st] == '0' && s[st + 1] == '1')
                k++;
            st++;
        }
        ret = max(ret, i - st + 1);
    }
    cout << ret << endl;
}


Measured memory_bytes: 512
def main():
    arr = [input() for _ in range(3)]
    curr = 0
    while len(arr[curr]) != 0:
        c = arr[curr][0]
        arr[curr] = arr[curr][1:]
        if c == "a":
            curr = 0
        elif c == "b":
            curr = 1
        else:
            curr = 2
    ans = ["A","B","C"]
    print(ans[curr])


if __name__ == "__main__":
    main()


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

int main(){
    int h,w,k; cin >> h >> w >> k;
    vector<vector<char>> g(h, vector<char>(w));
    vector<vector<int>> ans(h, vector<int>(w));

    rep(i,h) rep(j,w) cin >> g[i][j];
    int cnt = 1;

    rep(i,h){
        bool jud = false;
        rep(j,w){
            if(g[i][0] == '#') jud = true;
            if(j+1 <w && g[i][j+1] == '#'){
                ans[i][j] = cnt;
                if(j != w-1 && jud) cnt++;
                jud = true;
            }
            else ans[i][j] = cnt;
        }
        if(!jud){
            rep(j,w){
                if(i>0) ans[i][j] = ans[i-1][j];
                if(i==0) ans[i][j] = 0;
            }
            cnt--;
        }
        cnt++;
    }

    for(int i=h-1; i>=1; i--){
        for(int j=w-1; j>=0; j--){
            if(ans[i-1][j] == 0) ans[i-1][j] = ans[i][j];
        }
    }

    rep(i,h){
        rep(j,w){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>//小数点以下表示
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int n,k;
    cin>>n>>k;
    vector<int64_t> h(n);
    int64_t Sum=0;
    rep(i,n){
        cin>>h.at(i);
        Sum+=h.at(i);
    }
    if(n<=k){
        cout<<0<<endl;
    }
    else{
    sort(h.begin(),h.end());
    reverse(h.begin(),h.end());
    rep(i,k){
        Sum-=h.at(i);
    }
    cout<<Sum<<endl;
    }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 _main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (((abs(a - c) <= d) || (abs(a - b) <= d && (abs(b - c) <= d))) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  if( N%2==0 ){
    cout << (N/2-1);
  }else{
    cout << N/2;
  }
  
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef		 long long int     ll;
typedef		vector<ll>      vll;
#define     fi              first
#define     se              second
#define		pb              push_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		ss              ' '
#define     pii             pair<ll,ll>
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
const double eps = 1e-8;


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

    ll n;
    cin>>n;
    ll ar[n+10];
    for(ll i=1;i<=n;i++) ar[i]=2;
  //  memset(ar,1,sizeof(ar));
    ar[1]=1;
//    for(ll i=1;i<=n;i++)
//    {
//        cout<<ar[i]<<ss;
//    }
//    cout<<nn;
    for(ll i=2;i<=n;i++)
    {
        for(ll j=i+i;j<=n;j+=i)
        {
            ar[j]++;
        }
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    {
       ans+=i*ar[i];
    }
    cout<<ans<<nn;




}


/* Final check before submit :

1. array size or integer overflow,like uninitialised 0 index.

2. Think twice,code once.check all possible counter test case.

3. Be careful about corner case! n=1?k=1? something about 0?

4. avoid stupid mistake!complexity(t/m)?precision error?submit same code twice?

5. if got WA than remember that you are missing something common.
   *** Be confident!!! who knows? may be your one step back to AC ***

*/






Measured memory_bytes: 81740
import numpy as np

n = int(input())
ab = np.zeros((n, 2))

for i in range(n):
    a_tmp, b_tmp = map(int, input().split())
    ab[i, 0] = a_tmp
    ab[i, 1] = b_tmp

ab = sorted(ab, key=lambda x: x[1])

sum_ = 0
for i in range(n):
    sum_ += ab[i][0]
    if sum_ > ab[i][1]:
        print("No")
        exit()

print("Yes")


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

ll n, m, a, b, ans, c;
vector<pair<ll, ll>> v;

int main() {
    cin >> n >> m;
    for (int i=0; i<n; i++) {
        cin >> a;
        v.emplace_back(a, 1);
    }
    for (int i=0; i<m; i++) {
        cin >> a >> b;
        v.emplace_back(b, a);
    }
    sort(v.begin(), v.end(), greater<>());
    for (auto i : v) {
        if (i.second + c <= n) {
            c += i.second;
            ans += i.first * i.second;
        } else {
            ans += i.first * (n-c);
            break;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 6128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

struct mint {
	ll x;
	mint(ll x = 0) :x(x% mod) {}
	mint operator-() const { return(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(100005);

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	//sum(max) - sum(min)
	sort(a.begin(), a.end());
	mint ans = 0;
	rep(ri, 2) {
		rep(i, n) {
			mint now = comb(i, k - 1);
			if (ri == 1)now = -now;
			ans += now * mint(a[i]);
		}
		reverse(a.begin(), a.end());
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2176
import sys

class TreeNode:
    def __init__(self, val):
        self.val = val
        self.left = self.right = None

class BST:
    def __init__(self):
        self.root = None
    
    def insert(self, node):
        def helper(root):
            y, x = None, root
            while isinstance(x, TreeNode):
                y = x
                if node.val < x.val:
                    x = x.left
                else:
                    x = x.right
            if y is None:
                root = node
            elif node.val < y.val:
                y.left = node
            else:
                y.right = node
            return root
            
        self.root = helper(self.root)
    
    def inorder(self):
        def helper(root):
            return [] if root is None else helper(root.left) + [root.val] + helper(root.right)
        return helper(self.root)

    def preorder(self):
        def helper(root):
            return [] if root is None else [root.val] + helper(root.left) + helper(root.right)
        return helper(self.root)

if __name__ == '__main__':
    q = sys.stdin.readline()
    q = int(q)
    bst = BST()
    for i in range(q):
        tmp = sys.stdin.readline()
        if tmp.startswith('print'):
            print ' ' + ' '.join(map(lambda x: str(x), bst.inorder()))
            print ' ' + ' '.join(map(lambda x: str(x), bst.preorder()))
        else:
            _, val = tmp.split()
            node = TreeNode(int(val))
            bst.insert(node)

Measured memory_bytes: 241072
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>


#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define pf push_front
#define eb emplace_back 
#define all(v) (v).begin(), (v).end()
#define mod 100000
#define mi multiset<int>
#define mii multiset<pii>
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000

// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>


// using namespace __gnu_pbds;
using namespace std;

int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}

int modp(int a,int m,int n)
{
    n=n%(m-1);
    a=a%m;
    int res=1;
    while(n>0)
    {
        if(n&1) res=(res*a)%m;
        a=(a*a)%m;
        n>>=1;
    }
    return res;
}



void solve()
{
    int t,n,m,i,k,l,r,u,v,w,j,s,pos,sum=0,flag=0,count=0;
    string S,T,U;
    // int h1,m1,h2,m2;
    // long double a,b;
    cin>>n;
    vi a(n);
    rep(i,0,n)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            flag=1;
        }
    }
    if(flag)
    {
        cout<<"0";
        return;
    }
    int ans=1;
    l=(int)1e18;
    rep(i,0,n)
    {
        if(ans*a[i]>l)
        {
            cout<<"-1";
            return;
        }
        if(l/ans<a[i])
        {
            cout<<"-1";
            return;
        }
        ans*=a[i];
        if(ans>l)
        {
            cout<<"-1";
            return;
        }
    }
    cout<<ans;
}



signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}


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

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

    int count = 0;
    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            for(int k=j+1; k<N; k++){
                if(L[i]!=L[j] && L[j]!=L[k] && L[i]!=L[k]){
                    if(L[i]+L[j]>L[k] && L[i]+L[k]>L[j] && L[k]+L[j]>L[i]) { 
                        count++; 
                    }
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] a) {
        // Your code here!
        for(int dan = 1; dan < 10; dan++){
          for(int su = 1; su < 10; su++){
            System.out.println (dan + "x" + su + "=" + (dan * su));
          }
        }
    }
}



Measured memory_bytes: 24216
#include<stdio.h>
int main(void)
{
	int i,j,n,m,t[101],p[101],x[101],a[101];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&t[i]);
	}
	scanf("%d",&m);
	for(i=1;i<=m;i++){
		scanf("%d",&p[i]);
		scanf("%d",&x[i]);
	}
	for(i=1;i<=m;i++){
		a[i]=0;
		for(j=1;j<=n;j++){
			a[i]+=t[j];
		}
		a[i]=(a[i]-t[p[i]])+x[i];
	}
	for(i=1;i<=m;i++){
		printf("%d\n",a[i]);
	}
	return 0;
}

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

int main() {
  int64_t N, blue, red, num, blue_red, nokori;
  cin >> N >> blue >> red;
  blue_red = blue + red;
  nokori = (N % ( blue_red));
  num = N / ( blue_red ) * blue + min( blue, nokori);
  cout << num << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b;
	char op;
	scanf("%d %c %d",&a,&op,&b);
	(((0<=a)&&(a<=20000))&&((0<=b)&&(b<=20000)));
	while(!(op=='?'))
	{
	if(op=='+')
	{
		printf("%d\n",a+b);
	}
	else
	{
		if(op=='-')
		{
			printf("%d\n",a-b);
		}
		else
		{
			if(op=='*')
			{
				printf("%d\n",a*b);
			}
			else
			{
				if((op=='/')&&(b==0))
				{
					return 0;
				}
				else
				{
					printf("%d\n",a/b);
			}
			}
		}
	}
	scanf("%d %c %d",&a,&op,&b);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

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

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  vll V(3);
  cin >> V[0] >> V[1] >> V[2];

  if (V[0] % 2 == 0 || V[1] % 2 == 0 || V[2] % 2 == 0) {
    cout << 0 << endl;
    return 0;
  }

  sort(V.begin(), V.end(), less<>());
  cout << V[0] * V[1] << endl;

  return 0;
}


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

void caesar(string& txt){
    for(string::iterator it = txt.begin(); it != txt.end(); it++){
        (*it) = (*it-'A'+23)%26+'A';
    }
}

int main(){
    string ss;
    cin >> ss;
    caesar(ss);
    cout << ss << endl;
    return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

const int mod = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<P> ans;
    if (n % 2 == 0) {
        int target = n + 1;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (i + 1 + j + 1 == target) continue;
                ans.emplace_back(i, j);
            }
        }
    } else {
        int target = n;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (i + 1 + j + 1 == target) continue;
                ans.emplace_back(i, j);
            }
        }
    }
    cout << ans.size() << endl;
    for (P p: ans) printf("%lld %lld\n", p.first + 1, p.second + 1);
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
    using namespace std;
     
    typedef long long LL;
    typedef vector<int> vi;
    typedef vector<LL> vl;
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    typedef vector<pii> vpi;
    typedef vector<pll> vpl;
     
    #define fast ios_base::sync_with_stdio(0),cin.tie(0)
    #define temp template<typename T>
    #define debug(x) cerr<<"Line "<<__LINE__<<": "<<#x<<" = "<<x<<'\n'
    #define itr(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
    #define rep(i,a,b) for(int i=a;i<=(int)b;i++)
    #define repr(i,a,b) for(int i=a;i>=(int)b;i--)
    #define cas(n) printf("Case %d:",(int)n)
    #define mem(x,v) memset(x,v,sizeof(x))
    #define read(x) freopen(x,"r",stdin)
    #define write(x) freopen(x,"w",stdout)
    #define all(x) x.begin(),x.end()
    #define aut(x,v) for(auto &x:v)
    #define ini(n) scanf("%d",&n)
    #define inl(n) scanf("%lld",&n)
    #define ind(n) scanf("%lf",&n)
    #define ins(n) scanf("%s",n)
    #define insn(n) scanf(" %[^\n]",n)
    #define outi(n) printf("%d",(int)n)
    #define outl(n) printf("%lld",(LL)n)
    #define outd(n,p) printf("%.*lf",p,(double)n)
    #define outs(n) printf("%s",n)
    #define sz(x) (int)x.size()
    #define nl printf("\n")
    #define sp printf(" ")
    #define pb push_back
    #define mp make_pair
    #define xx first
    #define yy second
     
    const int inf=0x3f3f3f3f;
    const int mod=1000000007;
    const int mx=1000005;
    const LL  infL=0xf3f3f3f3f3f3f3f;
    const double eps=1e-9;
    const double pi=acos(-1.0);
     
     
    int main()
    {
        //read("in.txt"),write("out.txt");
        int n,m,ans=0;
        ini(n);
        rep(i,1,n) ini(m),ans+=m&1;
        if(ans)
            outs("first"),nl;
        else
            outs("second"),nl;
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define ll long long
using namespace std;
void deb(){
    cout<<"a";
    exit(0);
}
int main(){
    ll n,k;
    cin>>n>>k;
    vector<int> a(n),vi(n,-1);
    rep(i,0,n){
        cin>>a[i];
        a[i]--;
    }
    
    int cur=0;ll cnt=0;
    while(1){
        if(vi[cur]!=-1||k==cnt)break;
        vi[cur]=cnt;
        cur=a[cur];
        cnt++;
    }
    if(k>cnt){
        k-=vi[cur];
        cnt-=vi[cur];
        k%=cnt;
        rep(i,0,k)cur=a[cur];
    }
    cout<<cur+1<<endl;
}

Measured memory_bytes: 4832
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define mod 1000000007

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

    long long power = 1;
    for(int i = 0;i < n ; i++) {
        power *= i+1;
        power %= mod;
    }

    std::cout << power << std::endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
void solve()
{
	ll n;cin>>n;
	ll a[n];
	ll c=0;
	for(ll i=0;i<n;++i)
	{
		cin>>a[i];
		if(!(i&1))
		{
			if(a[i]&1)
				c++;
		}
	}
	cout<<c;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
        solve();
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[],int N){
  for(int i=0;i<N;i++){
    for(int j=N-1;j>=i+1;j--){
      if(A[j].value<A[j-1].value){
        Card t=A[j];
        A[j]=A[j-1];
        A[j-1]=t;
      }
    }
  }
}
void selection(struct Card A[],int N){
  for(int i=0;i<N;i++){
    int minj=i;
    for(int j=i;j<N;j++){
      if(A[j].value<A[minj].value)minj=j;
    }
    Card t=A[i];
    A[i]=A[minj];
    A[minj]=t;
  }
}
void print(struct Card A[],int N){
  for(int i=0;i<N;i++){
    if(i>0)cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card C1[],struct Card C2[],int N){
  for(int i=0;i<N;i++){
    if(C1[i].suit!=C2[i].suit)return false;
  }
  return true;
}
int main(){
  Card C1[100],C2[100];
  int N;
  char ch;

  cin >> N;
  for(int i=0;i<N;i++){
    cin >> C1[i].suit >> C1[i].value;
  }
  for(int i=0;i<N;i++)C2[i]=C1[i];
  bubble(C1,N);
  selection(C2,N);
  print(C1,N);
  cout << "Stable" << endl;
  print(C2,N);
  if(isStable(C1,C2,N)){
    cout << "Stable" << endl;
  }
  else{
    cout << "Not stable" << endl;
  }
  return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    long long n, m;
    cin >> n >> m;
    long long x = min(n, m), y = max(n, m);
    //long long ans = n * m;
    long long ans;
    if (x==1 && y == 1)
    {
        ans = 1LL;
    }
    else if (x == 1 && y!= 1)
    {
        ans = y-2LL;
    }
    else
    {
        ans = (x-2LL)*(y-2LL);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.nextInt();
            var b = cin.nextInt();
            Console.WriteLine(a*b);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 27476
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    ll tmp = min(a, k);
    ans += tmp;
    k -= tmp;
    tmp = min(b, k);
    k -= tmp;
    tmp = min(c, k);
    ans -= tmp;
    cout << ans << endl;

    return 0;
}


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

const int Maxn = 200005;

int H, W, N;
vector <int> my[Maxn];
int res;

int main()
{
    scanf("%d %d %d", &H, &W, &N);
    while (N--) {
        int X, Y; scanf("%d %d", &X, &Y);
        my[Y].push_back(X);
    }
    for (int i = 1; i <= W; i++) {
        my[i].push_back(H + 1);
        sort(my[i].begin(), my[i].end());
    }
    res = my[1][0] - 1;
    int c = 1, r = 2, cur = 1;
    for (int j = 2; j <= W; j++) {
        int ind = lower_bound(my[j].begin(), my[j].end(), r) - my[j].begin();
        while (r <= H && ind < my[j].size() && r == my[j][ind]) {
            r++; cur++; ind++;
        }
        if (r <= H) res = min(res, cur + my[j][ind] - r);
        r++; cur++;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 11392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 1e9+7;
    static vector<modint> factorial;
    modint(): num(0) {};
    modint(ll _n): num((_n + MOD) % MOD) {}
    modint(const modint &r): num(r.num) {}
    operator ll() const { return (num+MOD)%MOD; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }
    modint operator+(const modint &r) const { return modint(num + r.num); }
    modint operator-(const modint &r) const { return modint(num - r.num); }
    modint operator*(const modint &r) const { return modint(num * r.num); }
    template<typename T>
    modint operator^(const T &r) const {
        if(r == 0) return 1;
        return (((*this)*(*this)) ^ (r/2)) * modint(r&1 ? num : 1);
    }
    modint operator/(const modint &r) const { return num * (r^(MOD-2)); }
    modint operator+=(const modint &r) { return *this = *this + r; }
    modint operator-=(const modint &r) { return *this = *this - r; }
    modint operator*=(const modint &r) { return *this = *this * r; }
    modint operator/=(const modint &r) { return *this = *this / r; }
    template<typename T>
    modint operator^=(const T &r) { return *this = *this ^ r; }
    static modint fact(int n){
        if((int)factorial.size() <= n) factorial.resize(n+1);
        if(factorial[n]) return factorial[n];
        if(n == 0) return 1;
        return factorial[n] = modint(n) * fact(n-1);
    }
    static modint C(ll n,ll r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial;
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)

int main() {
    int X,Y;
    cin>>X>>Y;
    int x = 2 * Y - X;
    int y = 2 * X - Y;
    ll ans;
    if(x >= 0 && y >= 0 && x % 3 == 0 && y % 3 ==0){
        x /= 3;
        y /= 3;
        ans = H(x,y);
    }
    else{
        ans = 0;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 32256
n=int(input())
A=list(map(int,input().split()))
r=set()
def f(s,k):
    if k>=0:
        global r
        r.add(s)
        f(s+A[k-1],k-1)
        f(s,k-1)
f(0,n)
input()
for e in map(int,input().split()):print(['no','yes'][e in r])


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

using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector< pair< int, int>> vp;
    for (int i = 0; i < n; i++) {
        int x, r;
        cin >> x >> r;
        vp.emplace_back(x - r, x + r);
    }
    
    sort(begin(vp), end(vp), [](pair< int, int>&a, pair< int, int>&b){
       if (a.second == b.second) return a.first < b.first;
       return a.second < b.second;
    });
    
    int last = -2e9;
    int result = 0;
    for (int i = 0; i < n; i++) {
        if (vp[i].first >= last) {
            result++;
            last = vp[i].second;
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define rap(i,n) for(int i=0;i<n;++i)
using namespace std;
signed main(){
int n,z,a[100000],b=0;
  cin>>n>>z;
  rap(i,n){
    cin>>a[i];
    b+=a[i];
  }
  sort(a,a+n);
z-=b;
  z/=a[0];
  cout<<z+n<<"\n";
}

Measured memory_bytes: 256
import sys

n=input()
test=list(set(n))
#print(test)
if len(test)==1 and test[0]=="7":
    print(len(n))
    sys.exit()
n=int(n)
if n==1:
    print(1)
    sys.exit()
if n%2 ==0:
    print(-1)
    sys.exit()

Ai=[7%n]
for i in range(1,n+1):
    res=(Ai[i-1]*10 + 7)%n
    if res ==0:
        print(i+1)
        sys.exit()
    Ai.append(res)
print(-1)

Measured memory_bytes: 140852
N, K  = map(int, input().split())

zero = 0
even = 0

for i in range(1,N+1):
  if i % K == 0:
    zero += 1
  
  if K % 2 == 0:
    if i % K == K//2:
      even += 1

ans = 0
ans += zero**3
ans += even**3


print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int n, *d, cur = 101, next = 0, cnt = 0;
  scanf("%d", &n);
  d = (int*)malloc(sizeof(int) * n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &d[i]);
  }

  do {
    next = 0;
    for (int i = 0; i < n; i++) {
      if (next < d[i] && d[i] < cur) {
        next = d[i];
      }
    }
    cur = next;
    cnt++;
  } while (next != 0);
  printf("%d\n", cnt-1);

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
    int n,j,m=0;
    cin>>n;
    int a[110]={0};
    for(int i=0;i<n;i++){
		cin>>j;
		if(a[j]==0){
			a[j]=1;
			m++;
		}

    }

    cout<<m<<endl;

return 0;
}


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


int main(){
  int k;
  string s;
  cin >> k >> s;
  
  int l = s.size();
  k = min(l, k);
  string ans;
  for(int i = 0; i < k; i++) ans += s.at(i);
  if((int)ans.size() < l) ans += "...";
  
  cout << ans << endl;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    int a, penalty = 0, AC = 0;
    bool p[n + 10] = {false};
    int q[n + 10] = {0};
    string s;
    for(int i = 0; i < m; i++){
        cin >> a >> s;
        if(s == "AC" && p[a] != true){
            p[a] = true;
            AC++;
            penalty += q[a];
        }
        else if(s == "WA" && p[a] != true){
            q[a]++;
        }
    }
    cout << AC << ' ' << penalty << endl;
    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N,T=0,X=0,Y=0;
  string ans="Yes";
  cin>>N;
  rep(i,0,N){
    int t,x,y;
    cin>>t>>x>>y;
    int M=max(x,X)-min(x,X)+max(y,Y)-min(y,Y);
    int D=t-T;
    if(M<=D){
      if((D-M)%2==1){
        ans="No";
        break;
        }
      T=t;
      X=x;
      Y=y;
      }
    else{
      ans="No";
      break;
      }
    }
  cout<<ans;
  }


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

using namespace std;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
	
	int N,M; cin>>N>>M;
	vector<int> S(N), T(M);
	for (auto& s : S) cin>>s;
	for (auto& t : T) cin>>t;

	const unsigned long MOD = 1e9+7;
	unsigned long dp[2][M+1];
	for (int i = 0; i <= M; i++)
	    dp[0][i] = 1;
	for (int i = 1; i <= N; i++) {
        auto dpi = i%2;
        auto& cdp = dp[dpi];
        auto& pdp = dp[!dpi];
        cdp[0] = pdp[0];
	    for (int j = 1; j <= M; j++) {
	        cdp[j] = cdp[j-1] + pdp[j];
	        if (S[i-1] != T[j-1])
	            cdp[j] += MOD - pdp[j-1];
	        cdp[j] %= MOD;
	    }
	}
	cout << dp[N%2][M] << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)

int gcd(int x,int y){ return (!y ? x : gcd(y, x%y)); }
const int maxn = 1e5 + 10;
vi adj[maxn], tree[maxn];
int d[maxn], mark[maxn], ps[maxn];
set<int> out[maxn];
void dfs(int v){
	mark[v] = 1;
	for(auto u : adj[v]){
		if(!mark[u]){
			mark[u];
			//cout << v << "-" << u << endl;
			tree[v].push_back(u);
			dfs(u);
		}
	}
}
void d_t(int v){
	for(auto u : tree[v]){
		d_t(u);
		ps[v] ^= ps[u];
	}
}
int32_t main(){
	IOS;
	int n, m;
	cin >> n >> m;
	for(int i=0; i<m; i++){
		int u, v;
		cin >> u >> v;
		u--, v--;
		adj[u].push_back(v);
		out[u].insert(v);
		adj[v].push_back(u);
		d[u] ^= 1;
	}
	if(m & 1){
		cout << -1 << endl;
		return 0;
	}
	dfs(0);
	vi odd;
	for(int i=0; i<n; i++)
		if(d[i])
			odd.push_back(i), ps[i] ^= 1;
	d_t(0);
	/*
	for(int i=0; i<n; i++)
		cout << i << ":D" << ps[i] << endl;
	*/
	for(int i=0; i<n; i++)
		for(auto u : tree[i])
			if(ps[u]){
				if(out[i].find(u) != out[i].end()){
					out[i].erase(u);
					out[u].insert(i);
				}
				else{
					out[u].erase(i);
					out[i].insert(u);
				}
			}
	for(int i=0; i<n; i++){
		for(auto j : out[i]){
			cout << i + 1 << " " << j + 1 << endl;
		}
	}
}	


Measured memory_bytes: 27900
#include <iostream>
#include <string>
using namespace std;
int exp();
int term();
int factor();
int number();
int digit();
int p=0;
string str;
int main(){
  int n,re;
  cin >> n;
  while(n){
    p=0;
    cin >> str;
    re=exp();
    cout << re << endl;
    n--;
  }
  return 0;
}
int exp(){
  int val=term();
  while(str[p]=='+'||str[p]=='-'){
    if(str[p]=='+'){
      p++;
      val+=term();
    }else if(str[p]=='-'){
      p++;
      val-=term();
    }
  }
  return val;
}
int term(){
  int val=factor();
  while(str[p]=='*'||str[p]=='/'){
    if(str[p]=='*'){
      p++;
      val*=factor();
    }else if(str[p]=='/'){
      p++;
      val/=factor();
    }
  }
  return val;
}
int factor(){
  int val;
  if(str[p]=='('){
    p++;
    val=exp();
    p++;
  }else{
    val=digit();
  }
  return val;
}
int number(){
  int val=digit();
  return val;
}
int digit(){
  int ret,cnt=0;
  while(1){
    if(cnt==0&&'0'<=str[p]&&str[p]<='9'){
      ret=str[p]-'0';
      p++;
      cnt=1;
    }
    else if(cnt==1&&'0'<=str[p]&&str[p]<='9'){
      ret=ret*10+(str[p]-'0');
      p++;
    }
    else{
      break;
    }
  }
  /*  if('0' <= str[p] && str[p] <= '9') {
    if(cnt==0){
      ret=str[p]-'0';
      cnt=1;
    }
    p++;
    if('0' <= str[p] && str[p] <= '9') {
      ret=ret*10+(str[p]-'0');
      digit();
    }
    return ret;
    }*/
  return ret;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

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

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    cout << S[0] << S[1] << S[2] << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<cstdio> 
#include<algorithm>
#include<cmath>
#include<iostream>
#include<cstring>
#include<string>
#include<queue>
#include<map>
using namespace std;
int main()
{
    long long a,b,c;scanf("%lld%lld%lld",&a,&b,&c);
    printf("%lld\n",b/c-(a-1)/c+((a==0&&c!=1)?1:0));
    return 0;
}

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

int main() {
	// your code goes here
	
	int r,g,b;
	cin >> r >> g >> b;
	if((r*100 + g*10 + b) % 4 == 0){
		cout << "YES" <<endl;
	}
	else{
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  val c = Math.cos(Math.PI/3)
  val s = Math.sin(Math.PI/3)
  def main(args:Array[String]) = {
    val n = readInt
    var list = IndexedSeq((0D,0D),(100D,0D))
    (1 to n).foreach { _=>
      list = for{
        k<-0 until list.length-1; i = list(k); j = list(k+1)
        p1 = (i._1*2/3+j._1/3,i._2*2/3+j._2/3)
        p2 = (i._1/3+j._1*2/3,i._2/3+j._2*2/3)
        x = (p2._1-p1._1)*c-(p2._2-p1._2)*s+p1._1
        y = (p2._1-p1._1)*s+(p2._2-p1._2)*c+p1._2
        list2 = if(k==0) List(i,p1,(x,y),p2,j) else List(p1,(x,y),p2,j)
        q<-list2
      } yield q
    }

    for((i,j)<-list) printf("%.8f %.8f\n",i,j)
  }
}

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

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " "<< x << " " << y << endl;
  return 0;
};

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
const int MAXN = 100000;
const int MAXK = 1000;
int x[MAXN + 5], y[MAXN + 5], c[MAXN + 5];
int y1[10 * MAXK + 5];
int main() {
    int N, K, Max = 0, cnt = 0;
    scanf("%d%d",&N,&K);
    for(int i=1;i<=N;i++) {
        char ch;
        scanf("%d%d %c",&x[i],&y[i],&ch);
        x[i] = x[i] % (2*K);//降维 
        y[i] = y[i] % (2*K);
        if( ch == 'W' ) c[i] = 1;
        else c[i] = 0;
    }
    for(int i=0;i<=K;i++) 
    {
        cnt = 0;
        memset(y1,0,sizeof(y1));
        for(int j=1;j<=N;j++) 
        {
            int p = ( i<=x[j] && x[j] < i+K );
            int q = ( 0 <=y[j] && y[j] < K );
            //printf("%d %d",p,q); 
            if( p ^ q == c[j] )//通过位与来实现
            {
                cnt++;
                y1[y[j]] ++;
            }
            else 
            {
                y1[y[j]] --;
            }
        }
        for(int j=0;j<=K;j++) 
        {
            
            if( j != K )
                cnt = cnt - y1[j] - y1[K+j];
if( cnt > Max ) Max = cnt;
            if( N - cnt > Max ) Max = N - cnt;
        }
    }
    printf("%d\n",Max);
}

Measured memory_bytes: 1408
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    int l = line.length();
    String NumSt[] = new String[l];
    NumSt = line.split("",0);
    int dig;
    int sum = 0;
    
    for(int i = 0; i < l; i++){
      dig = Integer.parseInt(NumSt[i]);
      sum += dig;
    }
    
    if(sum % 9 == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 67288
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int a, b;

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

    if (a * b % 2 == 0) {
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
S = input()
k = "keyence"
if S.startswith(k) or S.endswith(k):
    print("YES")
    exit()
for i in range(1, len(k)):
    if S.startswith(k[:i]) and S.endswith(k[i:]):
        print("YES")
        break
else:
    print("NO")


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
long long h,ans=1,num=1;
int x;
int main(){
    cin >> h ;
    while(h>0){
        h/=2;
        x+=1;
    }
    //cout << x << endl;
  for(int i=1;i<x;i++){
      num = num*2;
ans += num;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int num;
  int quo, rem;
  int count;
  int dcm = 0;

  cin >> num;

  for(count = 2 ; count < 10 ; count++){
    quo = num / count;
    rem = num % count;

    if(quo < 10 && rem == 0){
      dcm = 0;
      break;
    }
    else{
      dcm = 1;
      continue;
    }
  }

  if (dcm == 0 || num == 1)
    cout << "Yes" << endl;
  
  if (dcm == 1 && num != 1)
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int x = b - a;
    cout << x * (x +1) / 2 - b << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

        int noDataSet = sc.nextInt();

        for (int i = 0; i < noDataSet; i++) {
            ArrayList<Integer> nums = new ArrayList<Integer>();
            nums.add(sc.nextInt());
            nums.add(sc.nextInt());
            nums.add(sc.nextInt());
            Collections.sort(nums);

            int a = nums.get(0);
            int b = nums.get(1);
            int c = nums.get(2);

            if (Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}

Measured memory_bytes: 32688
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;

int N, K;
int H[100001];
int memo[100001];

int solve(int n) {
  if (n < 0) return (1 << 30);
  if (n == 0) return 0;
  if (memo[n] != -1) return memo[n];

  int res = 1 << 30;
  int h;

  REP(i, 1, K + 1) {
    if (n - i < 0) h = 0;
    else h = H[n-i];
    res = min(res, solve(n-i) + abs(H[n] - h));
  }

  return memo[n] = res;
}

int main(void) {
  cin >> N >> K;
  rep(i, N) cin >> H[i];
  memset(memo, -1, sizeof(memo));
  cout << solve(N-1) << endl;
  return 0;
}


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

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

Measured memory_bytes: 4428