akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.util.function.*;
public class Main {
  	private static final int MAX = 510000;
	private static long[] fac = new long[MAX];
	private static long[] inv = new long[MAX];
	private static long[] finv = new long[MAX];
	private static final int constant = 998244353;
  
  	static {
    	fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i = 2; i < MAX; i++) {
			fac[i] = fac[i - 1] * i % constant;
			inv[i] = constant - inv[constant%i] * (constant / i) % constant;
			finv[i] = finv[i - 1] * inv[i] % constant;
		}
    }
  
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		int M = s.nextInt();
		int K = s.nextInt();

		final LongBinaryOperator pow = (i, j) -> {
			long result = 1;
			while(j > 0) {
				if((j & 1) == 1)
					result = (result * i) % constant;
				i = (i  * i) % constant;
				j >>= 1;
			}
			return result;
		};

		final IntUnaryOperator function = i -> {
			return (int)(M * getNewCom(N - 1, i) % constant * pow.applyAsLong(M-1, N-i-1) % constant);
		};
		
		long result = 0;
		for(int i = 0; i < K + 1; i++) {
			result = (result + function.applyAsInt(i)) % constant;
		}

		System.out.println(result);
    }
  
  	private static long getNewCom(int n, int k) {
		if( n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k] % constant) % constant;
	}
}

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

#define mp make_pair
#define pb push_back
#define f first
#define s second

using namespace std;

typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
typedef map<int,int> mii;
typedef unordered_map<int,int> umii;
typedef queue<int> qi;

int tab[3];

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
cin >> tab[0] >> tab[1] >> tab[2];
	swap(tab[0], tab[1]);
	swap(tab[0], tab[2]);
	cout << tab[0] << ' '<< tab[1] << ' ' << tab[2] << '\n';
	return 0;
}


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

const int ma=55556;
vector<bool> prime(ma,true);

void era(){
	prime[0]=false;
	prime[1]=false;
	rep(i,ma){
		if(prime[i]){
			for(int j=i+i;j<ma;j+=i){
				prime[j]=false;
			}
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	era();
	int cnt=0;
	vector<int> a;
	for(int i=3;i<ma;++i){
		if(prime[i] && i%5==1){
			a.pb(i);
			cnt++;
		}
		if(cnt==n) break;
	}
	rep(i,n){
		if(i==n-1) cout << a[i] << endl;
		else cout << a[i] << " ";
	}
}

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

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

constexpr int H_MAX = 500'000;

int A[H_MAX+1];

int parent(int i)   { return i / 2; }
int left(int i)     { return 2 * i; }
int right(int i)    { return 2 * i + 1; }

void maxHeapify(int i, int H) {
    int l = left(i);
    int r = right(i);
    int largest = 0;
    if (l <= H && A[l] > A[i]) {
        largest = l;
    } else {
        largest = i;
    }
    if (r <= H && A[r] > A[largest]) {
        largest = r;
    }
    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest, H);
    }
}

void buildMaxHeap(int H) {
    for (int i=H/2; i>0; --i) {
        maxHeapify(i, H);
    }
}

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

    int H;
    cin >> H;
    FOR(i,1,H+1) { cin >> A[i]; }
    buildMaxHeap(H);
    FOR(i,1,H+1) { cout << " " << A[i]; }
    cout << endl;

    return 0;
}

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



int main() {
	std::string S, T;

	std::cin >> S >> T;

	if (S.length() + 1 != T.length()) {
		std::cout << "No" << std::endl;
		return 0;
	}

	for (int i = 0; i < S.length(); i++) {
		if (S[i] != T[i]) {
			std::cout << "No" << std::endl;
			return 0;
		}
	}


	std::cout << "Yes" << std::endl;
	return 0;

}


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

int main()
{
    int n, r;
    cin >> n >> r;
    if(n >= 10) cout << r << endl;
    else {
        cout << r + 100 * (10 - n) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for _ in range(N):
    A = list(map(int, input().split()))
    total = 0
    for a, b in zip(A, B):
        total += a*b
    total += C
    if total > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3060
from fractions import gcd
A, B, C, D = map(int, input().split())
_A = A-1
print(int(B - _A - (B//C - _A//C + B//D - _A//D - B//(C*D//gcd(C, D)) + _A//int(C*D//gcd(C, D)))))


Measured memory_bytes: 5048
def nxt(y, x, h, w):
    if y % 2 == 0:
        if x < w - 1:
            yn, xn = y, x + 1
        else:
            yn, xn = y + 1, w - 1
    else:
        if x > 0:
            yn, xn = y, x - 1
        else:
            yn, xn = y + 1, 0
    return yn, xn


h, w = map(int, input().split())
a = []

for i in range(h):
    line = list(map(int, input().split()))
    a.append(line)

ret = []

for i in range(h * w - 1):
    y = i // w
    if y % 2 == 0:
        x = i % w
    else:
        x = w - 1 - (i % w)
    if a[y][x] % 2 != 0:
        yn, xn = nxt(y, x, h, w)
        ret.append((y+1, x+1, yn+1, xn+1))
        a[yn][xn] += 1

print(len(ret))
for item in ret:
    print(' '.join(map(str, item)))


Measured memory_bytes: 26208
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  ll a,b;
  cin >> a >> b;
  if((a*b)%2==0)cout << "Even" << endl;
  else cout << "Odd" << endl;
 
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	String A = sc.next();
	String B = sc.next();
	String C = sc.next();
	int ans = 0;
	for(int i = 0; i<N; i++) {
	    char a = A.charAt(i);
	    char b = B.charAt(i);
	    char c = C.charAt(i);
	    if(a == b && b == c) {
		continue;
	    }
	    if(a != b && b != c && c != a) {
		ans += 2;
		continue;
	    }
	    ans++;
	}
	System.out.println(ans);
    }
}

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

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main() {
    string s;
    int i, sum;

    getline(cin, s);

while(s!="0"){
    sum = 0;
    for(i=0;i<s.size();i++){
        sum = sum + ctoi(s[i]);
    }

    cout << sum << endl;

    getline(cin, s);
}

    return 0;
}



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

int main() {
  string s;
  cin >> s;
  

  string ans = "";
  for (int bit = 0; bit < (1<<3); bit++) {
    int sum = s.at(0) - '0';
    ans = s.at(0);
    rep(i, 3) {
      if ((bit >> i) & 1) {
        sum += s.at(i+1) - '0';
        ans += '+';
        ans += s.at(i+1);
      } else {
        sum -= s.at(i+1) - '0';
        ans += '-';
        ans += s.at(i+1);
      }
    }

    if (sum == 7) {
      cout << ans << "=7" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _ ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

int main() { _
    long long x, y;
    cin >> x >> y;
    if (x%y==0) return cout << -1 << endl, 0;
    cout << (x*y) - x << endl;
    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
from copy import deepcopy
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]

last = {}
for i in range(26):
    last[i] = -1

s = 0
Ret = []
for d in range(D):
    ret = 0
    sr = {}
    ll = {}
    for c in range(26):
        last_cp = deepcopy(last)
        s_cp = deepcopy(s)
        last_cp[c] = d
        s_cp += S[d][c]
        for i in range(26):
            s_cp -= C[i] * (d-last[i])
        sr[c] = s_cp
        ll[c] = last_cp
    sr = sorted(sr.items(), key=lambda x:x[1])
    ret = sr[-1][0]
    s += sr[-1][1]
    last = deepcopy(ll[ret])
    Ret.append(ret+1)

'''
print(Ret[0], end='')
for i in range(1, D):
    print('\n' + str(Ret[i]), end='')
'''

for r in Ret:
    print(r)


Measured memory_bytes: 9852
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int k, a, b;
  cin >> k >> a >> b;
  for(int i = a; i <= b; i++) {
    if(i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3600
import math
def is_anagram(string1, string2):
  for a in string1:
    if a not in string2:
      return False
    string2 = string2.replace(a, "", 1)
  if len(string2) == 0:
    return True
  else:
    return False

from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N = int(input())
anagrams = {}
for i in range(N):
  string = ''.join(sorted(input()))
  if string in anagrams:
    anagrams[string] += 1
  else:
    anagrams[string] = 0

ans = 0
for anagram_num in anagrams.values():
  if anagram_num> 0:
    ans += int(cmb(anagram_num+1,2)) 
print(ans)

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

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

void Main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n % 2 == 1) {
    cout << "No" << endl;
    return;
  }
  int flag = 1;
  rep(i, n / 2) {
    if (s[i] != s[i + n / 2]) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL A, B;
	in >> A >> B;
	out << std::max({ A + B,A + A - 1,B + B - 1 }) << std::endl;
}


Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

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

int main() {
	int n, h, w;
	cin >> n >> h >> w;
	VI a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];

	int cnt = 0;
	rep(i, n) {
		if (a[i] >= h && b[i] >= w) {
			cnt++;
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
//shara's here
#include <bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
int main(){
    ll a,b;
    s ss;
    cin>>a>>ss>>b;
    if(ss == "+")cout<<a+b;
    else cout<<a-b;
return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<deque>
#define sqr(x) (x)*(x)
using namespace std;
int n,i,x;
deque<int> arr;
int main()
{
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>x;
		if (i&1) arr.push_back(x); else arr.push_front(x);
	}
	for (i=1;i<=n;i++)
	{
		if (n&1)
		{
			cout<<arr.back()<<' ';
			arr.pop_back();
		}
		else
		{
			cout<<arr.front()<<' ';
			arr.pop_front();
		}
	}
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ i=0;i<(int__)(j);i++)
#define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++)
#define all(v) v.begin(),v.end()

template<typename T>
ostream& operator << (ostream &os , const vector<T> &v){
    rep(i,v.size()) os << v[i] << (i!=v.size()-1 ? " " : "\n"); return os;
}

template<typename T>
istream& operator >> (istream &is , vector<T> &v){
    rep(i,v.size()) is >> v[i]; return is;
}

#ifdef DEBUG
void debug(){ cerr << endl; }
#endif
template<class F,class...R>
void debug(const F &car,const R&... cdr){
#ifdef DEBUG
    cerr << car << " "; debug(cdr...);
#endif
}


bool solve(){
    string s; cin >> s;
    int n = s.size();
    vector<string> v;
    repeat(i, 1 ,n+1) {
        string s1 = s.substr(0, i);
        string s2 = s.substr(i);
        string s1r = s1; reverse( all(s1r) );
        string s2r = s2; reverse( all(s2r) );
        v.push_back(s1  + s2);
        v.push_back(s1r + s2);
        v.push_back(s1  + s2r);
        v.push_back(s1r + s2r);
        v.push_back(s2  + s1);
        v.push_back(s2r + s1);
        v.push_back(s2  + s1r);
        v.push_back(s2r + s1r);
    }
    sort( all(v) );
    v.erase( unique( all(v)), v.end());
    cout << v.size() << endl;
    return false;
}

int main()
{
    ios::sync_with_stdio(false);
    int m; cin >> m;    
    while(m--) solve();
    return 0;
}

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

int main () {
  int a, b, c;
  cin >> a >> b;
  c = a - a / 500 * 500;
    if (c <= b) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
  }
}
  
  
  

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;


#define MAX 123456*2+1
int pnum[MAX] = {0};

void ini(){
	for(int i=2;i<=MAX;i++){
		pnum[i]++;
	}
	for(int i=2;i<=sqrt(MAX)+1;i++){
		for(int j=i+1;j<=MAX;j++){
			if(pnum[j] && j % i == 0) pnum[j]--;
		}
	}
	
	return;
}


bool solve(){
	int n;
	cin>> n;
	if(!n) return false;
	
	int ans = 0;
	for(int i=n+1;i<=2*n && i<=MAX;i++){
		if(pnum[i]) ans++;
	}
	cout<< ans<< endl;
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	ini();
	while(solve());

	return 0;
}

 

Measured memory_bytes: 2124
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define cpresent(c,x) ((c).find(x) != (c).end()) 
#define vpresent(c,x) (find(all(c),x) != (c).end())
#define endl '\n'
#ifdef LOCAL
#include "/home/iggaboi/Desktop/CP/debug.h"
#else
#define debug(Args...)
#endif
using ll = long long;
using namespace __gnu_pbds;
using namespace std;
template<class T>
using indexed_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;

string s, t;

void shit() {
	cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.length(); ++i) {
        if(s[i] != t[i]) ++ans;
    }
    cout << ans << endl;
}

int32_t main() {
	ios_base::sync_with_stdio(false),cin.tie(nullptr);
	// int t; cin >> t;
	// while(t--)
		shit();
	return 0;
}


Measured memory_bytes: 3820
N=int(input())
A=list(map(int,input().split()))
B=[0]
for i in range(N):
  B+=[B[i]+A[i]]
C=[]
ans=0      
B.sort()
c=1
for i in range(1,N+1):
  if B[i]==B[i-1]:
    c+=1
  else:
    ans+=c*(c-1)//2
    c=1
ans+=c*(c-1)//2
print(ans)

Measured memory_bytes: 99536
s = input().strip()
t = input().strip()

i = 0
ans = 0
while i + len(t) <= len(s):
    tmp = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            tmp += 1
    ans = max(ans, tmp)
    i += 1
print(len(t) - ans)


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

int main () {

    int N, M;
    cin >> N >> M;

    vector<vector<bool>> A(N, vector<bool>(M, false));

    for (int i = 0; i < N; i++) {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++) {
            int a;
            cin >> a;
            A[i][a-1] = true;
        }
    }

    int ans = 0;

    for (int i = 0; i < M; i++) {
        bool judge = true;
        for (int j = 0; j < N; j++) {
            judge &= A[j][i];
        }

        if (judge) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import math
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    min_ = n - 1
    for a in range(2, int(math.sqrt(n))+1):
        if n % a == 0:
            b = n // a
            min_ = min((a-1) + (b-1), min_)
    print(min_)
    
if __name__ == '__main__':
    main()

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

int main()
{	
	int a,b,c;
	
	while (scanf("%d%d%d",&a,&b,&c)==3)
	{
		if (a+b>=c)
		{
			printf("Yes");
		}
		
		else
		{
			printf("No");
		}
	}
	
	return 0;
 } 

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

using namespace std;

int main()
{
    string s;
    cin >> s;

    string str = s.substr(0, 2);
    int num = atoi(str.c_str());
    
    string str2 = s.substr(2, 2);
    int num2 = atoi(str2.c_str());
    
    if (num > 0 && num <= 12 && num2 > 0 && num2 <= 12)
    {
        cout << "AMBIGUOUS" << endl;
    }
    else if(num > 0 && num <= 12)
    {
        cout << "MMYY" << endl;
    }
    else if(num2 > 0 && num2 <= 12)
    {
        cout << "YYMM" << endl;
    }
    else
    {
        cout << "NA" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

#include <bits/stdc++.h>
using namespace std;

int main(){
  int k;
  string s;
  cin>>k>>s;
  
  if(s.size()<=k) cout<<s<<endl;
  else{
    s.erase(k);
    cout<<s<<"..."<<endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs(a-b)<EPS)

int main(){

	int wide,height,length;
	while(cin>>height>>wide>>length&&!(wide==0&&height==0&&length==0)){
		priority_queue<int,vector<int> ,greater<int> > pq;
		pq.push(height);
		pq.push(wide);
		pq.push(length);

		int l1,l2;
		l1=pq.top(),pq.pop();
		l2=pq.top(),pq.pop();
		int n;
		cin>>n;
		double d=sqrt(((double)l1/2)*((double)l1/2)+((double)l2/2)*((double)l2/2));
		for(int i = 0; i < n; i++){
			int r;
			cin>>r;
			// ツ禿シツづィツ古サツつイツづづ可チツーツズツつェツ運ツづ堕つアツづ淞づゥツつゥツ計ツ算
			if(!EQ(d,r)&&r>d)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    long long q,h,s,d;
    cin >> q >> h >> s >> d;
    int n;cin>>n;
    long long m=min({q*4,h*2,s});
    if(m*2<d){
        cout<<m*n<<endl;
    }else{
        if(n%2==0){
            cout<<d*n/2<<endl;
        }else{
            cout<<d*(long long)(n/2)+m<<endl;
        }
    }
}

Measured memory_bytes: 256
import bisect
N = int(input())
l = list(map(int,input().split()))
l.sort()
#print(l)


ans = 0
for i in range(N - 1 , 1, -1):
    for j in range(i - 1 , 0 , -1):
        #work = l[:j]
        x = l[i] - l[j]
        #idx = bisect.bisect_right(work, x)
        idx = bisect.bisect_right(l, x)
        ans += max(j - idx , 0)
print(ans)


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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

int a[100005],no[100005];
int main() {
    int n,m;
    cin>>n>>m;
    ii cin>>a[i];
    ij {
        int u,v;
        cin>>u>>v;
        if(a[u] > a[v]) no[v]=1;
        else if(a[u] < a[v]) no[u]=1;
        else no[v] = no[u] = 1;
    }
    int cnt=0;
    ii if(!no[i]) ++cnt;
    cout<<cnt<<endl;
}

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

using namespace std;
#define int long long

const int N = 110;

int n;

struct Point {
    int x, y;
    Point(int x = 0, int y = 0) : x(x), y(y) {}
    long long operator % (const Point &u) const {
        return 1ll * x * u.y - 1ll * u.x * y;
    }
    Point operator + (const Point &u) const {
        return Point(x + u.x, y + u.y);
    }

    long long norm() {
        return 1ll * x * x + 1ll * y * y;
    }
} a[N + N];

int get(Point &u) {
    return u.y > 0 || (u.y == 0 && u.x >= 0);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].x >> a[i].y;
        if (a[i].x == 0 && a[i].y == 0) {
            n--;
            i--;
        }
    }
    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }
    sort(a + 1, a + n + 1, [](Point &u, Point &v) {
        if (get(u) != get(v)) {
            return get(u) == 1;
        }
        return (u % v) > 0;
    });     
    for (int i = 1; i <= n; i++) {
        a[i + n] = a[i];
    }
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        Point cur(0, 0);
        for (int j = i; j < i + n; j++) {
            cur = cur + a[j];
            res = max(res, cur.norm());
        }
    }   
    cout << fixed << setprecision(14) << sqrt(res) << endl;
    return 0;
}

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

const ll INF = 10010010010;

int main(){
    int v,e,r;
    cin >> v >> e >> r;
    vector<vector<ll>> to(v);
    vector<vector<ll>> weight(v);
    vector<ll> distance(v);
    //vector<int> visited(v);
    rep(i,e){
        int s,t,d;
        cin >> s >> t >> d;
        to[s].push_back(t);
        weight[s].push_back(d);

        //無向グラフ
        //to[t].push_back(s);
        //weight[t].push_back(d);

    }
    rep(i,v){
        distance[i]=INF;
        //visited[i]=0;
    }
    
    priority_queue<P,
    vector<P>,
    greater<P>
    > Q;
    P p(0,r);
    Q.push(p);
    //visited[r]=1;
    distance[r]=0;

    //int count = 0;
    while(!Q.empty()){
        P now;
        now = Q.top();
        Q.pop();
        if(now.first>distance[now.second]) continue;
        //cout << "now: " << now.first << " "<< now.second << endl;
        rep(i,to[now.second].size()){
            P temp;
            temp.second = to[now.second][i];
            temp.first = now.first+weight[now.second][i];
            
            //cout << "to: " << temp.second <<" " <<temp.first << endl;
            //count++;
            if(temp.first<distance[temp.second]){
                Q.push(temp);
                distance[temp.second]=temp.first;
                //visited[temp.second]=1;
            }
        }

        /*        
        cout << "temp"<<endl;
        rep(j,v){
        cout << j << " " << distance[j] << endl;
        }
        */

    }

    //cout << "ans" << endl;
        rep(i,v){
        if(distance[i]<INF) cout << distance[i] << endl;
        else cout << "INF" << endl;
    }
    //cout << "count: " << count << endl;



}


Measured memory_bytes: 23140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		String s,p,temp;
		boolean match = false;
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	s = br.readLine();
    	p = br.readLine();
    	br.close();

    	s = s + s;
    	for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	}
    	if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    }
}

Measured memory_bytes: 24472
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x;
    cin >> x;
    if(x >= 2000) {
        cout << 1 << '\n';
        return 0;
    } 
    int mod, res;
    mod = x /100;
    res = mod  * 100;
    if(res <= x && res+mod*5 >= x) {
        cout << 1 << '\n';
        return 0;
    } else {
        cout << 0 << '\n';
        return 0;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<ctime>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define P_TYPE int
typedef pair<P_TYPE, P_TYPE> P;
typedef pair<P, P_TYPE> PI;
typedef pair<P_TYPE, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

ll fast_pow(ll x, ll n, ll m) {
  ll r = 1;
  while(n > 0) {
    if(n & 1) {
      r = (r * x) % m;
    }
    x = (x * x) % m;
    n >>= 1;
  }
  return r;
}

#define MOD 1000000007

int main() {
  int m, n;
  cin >> m >> n;
  cout << fast_pow(m, n, MOD) << endl;
  return 0;
}


Measured memory_bytes: 3132
n = int(input())
h = [int(i) for i in input().split()]
for j in range(n-1):
  if h[j] - h[j+1] > 1:
    print("No")
    exit()
  elif h[j] == h[j+1] + 1:
    h[j+1] += 1
print("Yes")


Measured memory_bytes: 14396
#include<iostream>
#include<cstdio>
using namespace std;
int field[52][52]={};
void umeru(int y,int x){
	field[y][x]=0;
	for(int i=-1;i<=1;i++){
		for(int j=-1;j<=1;j++){
			if(field[y+i][x+j])	umeru(y+i,x+j);
		}
	}
}
int main(){
	while(1){
		int w,h,cnt=0;
		cin >> w >> h;
		if(!w&&!h)	break;
		for(int i=1;i<=h;i++){
			for(int j=1;j<=w;j++){
				cin >> field[i][j];
			}
		}
		for(int i=1;i<=h;i++){
			for(int j=1;j<=w;j++){
				if(field[i][j]){
					cnt++;
					umeru(i,j);
				}
			}
		}
		cout << cnt << endl;
	}
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#define N 200010
int n;
int a[N],b[N];
long long ans;
int main(int argc,char *argv[]){
	cin >> n;
	for (int i=1;i<=n+1;i++)	cin >> a[i];
	for (int i=1;i<=n;i++)	cin >> b[i];
	ans=0;
	for (int i=1;i<=n;i++){
		if (b[i]>=a[i]){
			ans+=a[i];
			b[i]-=a[i];
			if (b[i]>=a[i+1]){
				ans+=a[i+1];
				a[i+1]=0;
			}
			else{
				ans+=b[i];
				a[i+1]-=b[i];
			}
		}
		else ans+=b[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int a,b;

		Scanner scan = new Scanner(System.in);

		while ((scan.hasNext())) {

			a = Integer.parseInt(scan.next());
			b = Integer.parseInt(scan.next());

			String length = String.valueOf(a + b);

			System.out.println(length.length());

		}
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

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

		int sheet[][] = new int[3][3];
		for(int i = 0; i < 3; i++)
			for(int j = 0; j < 3; j++)
				sheet[i][j] = sc.nextInt();

		int N = sc.nextInt();
		for(int n = 0; n < N; n++){
			int x = sc.nextInt();
			for(int i = 0; i < 3; i++)
				for(int j = 0; j < 3; j++)
					if(sheet[i][j] == x)sheet[i][j] = 0;
		}

		boolean flag;

		boolean f1 = false;
		boolean f2 = false;

		for(int i = 0; i < 3; i++){
			f1 = true;
			f2 = true;
			for(int j = 0; j < 3; j++){
				if(sheet[i][j] != 0)f1 = false;
				if(sheet[j][i] != 0)f2 = false;
			}
			if(f1 || f2)break;
		}
		
		flag = f1 || f2;
		
		if(!flag){
			f1 = true;
			f2 = true;
			for(int i = 0; i < 3; i++){
				if(sheet[i][i] != 0)f1 = false;
				if(sheet[i][2 - i] != 0)f2 = false;
			}
			flag = flag || f1 || f2;
		}


		System.out.println((flag)?"Yes":"No");
	}
}

Measured memory_bytes: 23380
# -*- coding: utf-8 -*-
#ABC122C
import sys
import copy
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
q=hoge[1]

s = input()

ans=[]
sum=0
#print(s)

for j in range(0,n-1):
	if(s[j]=="A")and(s[j+1]=="C"):
		sum+=1
	ans.append(sum)
	#print(s[j])
ans.append(sum)
ans.append(0)
#ans[n-1]=sum
#print(ans)
#print(ans)

l=[]
r=[]
sum=0
for i in range(0,q):
	tmp = input().split()
	hoge = list(map(lambda a: int(a), tmp))

	print(ans[hoge[1]-2]-ans[hoge[0]-2])

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

using namespace std;

int main(){
	string s;
	cin>>s;
	set<char> set;
	for(int i=0;i<s.size();i++){
		set.insert(s[i]);
	}
	
	if(set.size()==2){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
signed main(){
    int x[5],i;
    for(i=0;i<5;i++){
        scanf("%d",&x[i]);
    }
    for(i=0;i<5;i++){
        if(x[i]==0){
            printf("%d\n",i+1);
        }
    }
    return(0);
}


Measured memory_bytes: 1700
import numpy as np
N = int(input())
A = [np.array(input().split(), dtype=np.int64) for _ in [0]*N]
inf = 10**10
for i in range(N):
    A[i][i] = inf
 
result = 0
for i in range(N-1):
    for j, d1 in enumerate(A[i][i+1:], start=i+1):
        d2 = np.min(A[i]+A[j])
        if d1 >= d2:
            if d1 > d2:
                print(-1)
                exit()
        else:
            result += d1
print(result)

Measured memory_bytes: 13180
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    long N;
    cin>>N;
    long a[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    long count2=0; long count4=0;
    for(int i=0;i<N;i++){
       if(a[i]%4==0){count4++;}
       else if(a[i]%2==0){count2++;}
    }
    if(count4*2+count2>=N){cout<<"Yes";}
    else if(N%2==1&&count4==(N-1)/2){cout<<"Yes";}
    else {cout<<"No";}
    return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;

int main(){
	int n;	cin >> n;
	int ans[n] = {0};
	int tmp;

	for( int x = 1; x <= 100; x++ )
	for( int y = 1; y <= 100; y++ )
	for( int z = 1; z <= 100; z++ ){
		tmp = x*x + y*y + z*z + x*y + x*z + y*z;
		if( tmp <= n )	ans[tmp - 1]++;
	}

	for( int i = 0; i < n; i++ ){
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3520
#include<bits/stdc++.h>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test IOS long long t;cin >> t;while(t--)
using namespace std;
typedef long long v99;
const double pi=acos(-1.0);
#define MX 99999
vector<int>v;
map<int,int>mp;
map<int,int>::iterator it;
int gcd(int a,int b){
    if(b==0)return a;
    return (b,a%b);
}
int main()
{
    char a;cin>>a;
    if(a>='a'&&a<='z')  cout<<"a"<<endl;
    else cout<<"A"<<endl;
    return 0;
}


Measured memory_bytes: 3676
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

	int i;
	for (i = 1; (i <<= 1) <= n;);

	cout << i / 2 << endl;
}

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

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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

const double PI=3.14159265358979323846;

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double ratioh = (h * 60 + m) / 720;
    double hx = sin(2 * PI * ratioh) * a;
    double hy = cos(2 * PI * ratioh) * a;
    double ratiom = m / 60;
    double mx = sin(2 * PI * ratiom) * b;
    double my = cos(2 * PI * ratiom) * b;
    double ax = hx - mx;
    double ay = hy - my;
    double ans = sqrt(ax * ax + ay * ay);
    cout << setprecision(15) << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  int N2 = N;
  int count = 0;
  while(N != 0) {
    count += N % 10;
    N = N / 10;
  }
  if(N2 % count == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math


n = int(input())
tmp = int(math.sqrt(n)) + 1
result = n-1
for num in range(2, tmp):
    a = n // num
    b = n % num
    tmp_result = a + num - 2
    if (b==0) & (tmp_result < result):
        result = tmp_result

print(result)



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

using namespace std;

typedef long long ll;

const int MX = 404;
const ll MOD = 998244353;

template <typename T> void add(T &x, const T &y)
{
	x = (x+y) % MOD;
}

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

ll qpow(ll x, ll t)
{
	ll ans = 1;
	while(t)
	{
		if(t & 1) ans = ans * x % MOD;
		x = x * x % MOD;
		t >>= 1;
	}
	return ans;
}

ll inv(ll x)
{
	return qpow(x, MOD-2);
}

ll fac[MX], faci[MX], ivx[MX];
ll f[2][MX][MX];
int A[MX], B[MX], sA[MX], sB[MX];
int n;

void init()
{
	fac[0] = 1;
	for(int i=1; i<MX; i++) fac[i] = fac[i-1] * i % MOD;
	faci[MX-1] = inv(fac[MX-1]);
	for(int i=MX-1; i>=1; i--) faci[i-1] = faci[i] * i % MOD;
	for(int i=1; i<MX; i++) ivx[i] = faci[i] * fac[i-1] % MOD;
}

void input()
{
	read(n);
	for(int i=1; i<=n; i++)
	{
		read(A[i]), sA[i] = sA[i-1] + A[i];
		read(B[i]), sB[i] = sB[i-1] + B[i];
	}
}

void print_coef(ll *s)
{
	for(int i=0; i<=4; i++) printf("%lld ", s[i]*fac[i]%MOD);
	putchar('\n');
}

void work()
{
	int now = 0;
	f[now][0][0] = MOD-1;
	for(int i=1; i<=n; i++)
	{
		memmove(f[now^1], f[now], sizeof(f[now^1]));
		for(int j=A[i]; j<=sA[i]; j++)
		{
			for(int b=0; b<=sB[i-1]; b++)
			{
				ll tmp = 1;
				for(int a=0; a<B[i]; a++)
				{
					add(f[now^1][j][a+b], MOD*MOD - f[now][j-A[i]][b]*tmp);
					tmp = tmp * ivx[a+1] % MOD * A[i] % MOD;
				}
			}
		}
		now ^= 1;
	}
	ll ans = 0;
	for(int i=1; i<=sA[n]; i++)
		for(int j=0; j<=sB[n]; j++)
			add(ans, f[now][i][j] * fac[j] % MOD * qpow(inv(i), j+1) % MOD);
	printf("%lld\n", ans * sA[n] % MOD);
}

int main()
{
	init();
	input();
	work();
	return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(void){
  ll n, m, ans; cin >> n >> m;
  if (n > m) swap(n, m);
  if (n==1 && m==1) ans = 1;
  else if (n==1) ans = m-2;
  else ans = (n-2) * (m-2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll inv[225816],fac[225816];

ll rwpw(ll a, ll p){
	ll ret = 1ll;
	while(p){
		if(p%2){
			mul_mod(ret,a);
		}
		mul_mod(a,a);
		p /= 2;
	}
	return ret;
}

ll c(ll n, ll k){
	ll ret = 1ll;
	if(n<k){
		return 0ll;
	}
	ret = fac[n];
	mul_mod(ret,(inv[k]*inv[n-k])%MOD);
	return ret;
}

int main(void){
	ll i,n,m,k,f,x=0ll,tmp,ans=0ll;
	cin >> n >> m >> k;
	f = n*m;
	fac[0] = 1ll;
	inv[0] = 1ll;
	for(i=1; i<=n*m; ++i){
		fac[i] = fac[i-1];
		mul_mod(fac[i],i);
		inv[i] = inv[i-1];
		mul_mod(inv[i],rwpw(i,MOD-2));
	}
	for(i=1; i<n; ++i){
		tmp = (n-i);
		mul_mod(tmp,i);
		mul_mod(tmp,(m*m)%MOD);
		mul_mod(tmp,c(n*m-2,k-2));
		add_mod(ans,tmp);
	}
	for(i=1; i<m; ++i){
		tmp = (m-i);
		mul_mod(tmp,i);
		mul_mod(tmp,(n*n)%MOD);
		mul_mod(tmp,c(n*m-2,k-2));
		add_mod(ans,tmp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <algorithm>
#include <iostream>
#include <stdio.h>

#define MAX_N 100'000

using namespace std;

int main() {
  int N;
  cin >> N;
  int h;
  cin >> h;
  int res = 0;
  int cnt = 0;
  for (int i = 1; i < N; ++i) {
    int _h;
    cin >> _h;
    if (h >= _h) {
      ++cnt;
    } else {
      res = max(res, cnt);
      cnt = 0;
    }
    h = _h;
  }
  printf("%d\n", max(res, cnt));
}

Measured memory_bytes: 3252
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;
const int MAX_V = 110;

struct Flow{
    struct edge{
        int to, cap, rev;
    };
    vector<edge> G[MAX_V];//隣接リスト
    bool used[MAX_V];

    void add_edge(int from, int to, int cap){
        G[from].push_back((edge){to, cap, (int)G[to].size()});//from -> to
        G[to].push_back((edge){from, 0, (int)G[from].size() - 1});//to -> from
    }

    //増加パスを探す
    int dfs(int v, int t, int f){
        if(v == t) return f;
        used[v] = true;
        for (int i = 0; i < G[v].size(); ++i){
            edge &e = G[v][i];
            if(!used[e.to] && e.cap > 0){
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    //sからtへの最大流
    int max_flow(int s, int t){
        int flow = 0;
        while(1){
            memset(used, 0, sizeof(used));
            int f = dfs(s, t, INF);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int main(void){
    int V, E; cin >> V >> E;
    Flow mf;
    rep(i, E){
        int u, v, c; cin >> u >> v >> c;
        mf.add_edge(u, v, c);
    }
    printf("%d\n", mf.max_flow(0, V - 1));
    return 0;
}


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

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

int main(){
    long long a, b, c, k;
    cin >> a >> b >> c >> k;


    long long ans = 0;
    if(k <= a){
        ans = k;
    }
    else if(k <= a + b){
        ans = a;
    }
    else if(k > a + b){
        ans = a;
        long long dif = k - a - b;
        ans -= dif;
    }

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

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;



namespace CSharpSample01
{

    
      
    class Program
    {

        static int[,] train;
        static int[,] c;
        static int N;

        static int Solve(int p, int q)
        {
            int rec = 0;

            for(int i = p; i <= q; i++)
            {
                rec += c[i, q] - c[i, p - 1];
            }

            return rec;
        }

        static void CreateC()
        {           
            for(int i = 1; i <= N; i++)
            {
                for(int j = 1; j <= N; j++)
                {
                    c[i, j] = c[i, j - 1] + train[i, j];  //累積和を撮る
                }
            }

        }

        static void Main(string[] args)
        {
            //入力1(N, M, Q)
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            N = input[0];
            int M = input[1];
            int Q = input[2];

            train = new int[N + 1, N + 1];
            c = new int[N + 1, N + 1];

            //入力2(train)
            for(int i = 0; i < M; i++)
            {
                input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                int l = input[0];
                int r = input[1];
                train[l, r]++;
            }

            //累積和c生成
            CreateC();

            //入力3(各クエリを解く)
            for(int i = 0; i < Q; i++)
            {
                input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                int p = input[0];
                int q = input[1];
                Console.WriteLine(Solve(p, q));
            }
            
        }
    }

}

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

int main()
{
    int n;
    cin >> n;
    map<long long, int> mp;
    long long a[100001];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        mp[a[i]]++;
    }
    long long w = 0;
    for(auto itr = mp.rbegin(); itr != mp. rend(); itr++){
        if(w == 0){
            if(itr->second >= 4){
                cout << itr->first * itr->first << endl;
                return 0;
            }
            if(itr->second >= 2){
                w = itr->first;
            }
        }
        else{
            if(itr->second >= 2){
                cout << itr->first * w << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}

Measured memory_bytes: 7296
import math

N, M = map(int, input().split())
mod = 10**9+7

if abs(N - M) >= 2:
    print(0)
elif N == M:
    print(((math.factorial(N) % mod) * (math.factorial(M) % mod) * 2) % mod)
else:
    print(((math.factorial(N) % mod) * (math.factorial(M) % mod)) % mod)

Measured memory_bytes: 10076
#include<stdio.h>

int Count(str,count){
    int s;
    if(str>3 && (str%3)==0){
        count++;
        Count((str/3),count);
    }
    else if(str>3 && str%3!=0){
        count++;   
        Count(((str/3)+1),count);
    }
    else if(str<=3){
        count++;
        return count;
    }
}

int main(){

    int str;
    int output=0;
    int count=0;
    
    scanf("%d",&str);
    if(str>=2 && str<=2000000000){
        output=Count(str,count);
        printf("%d\n",output);
    }
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define rep1(i,n) for(int i=1;i<=((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef long long ll;

const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;

		b>>=1;
	}
	return res;
}
void exgcd(int a,int b,int &x,int &y,int &d)
{
    if (b==0) x=0,y=1,d=a;
    else exgcd(b,a%b,y,x,d),y-=(a/b)*x;
}
int n;
int a[maxn];
int main()
{
    IOS;
    while(cin>>n)
    {
        ll d=0,sum=0;
        rep(i,n)
        {
            cin>>a[i];
            if(a[i]<0) d++;
            a[i]=abs(a[i]);
            sum+=a[i];
        }
        sort(a,a+n);
        if(d%2) cout<<sum-2*a[0]<<"\n";
        else cout<<sum<<"\n";
    }
	return 0;
}

Measured memory_bytes: 640
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

prev = A[0]
ans = 1
sign = 0

for i in range(1,n):
    if A[i] == prev:
        continue
    if A[i] > prev:
        if sign == -1:
            ans += 1
            prev = A[i]
            sign = 0
            continue
        else:
            sign = 1
            prev = A[i]
            continue
    if A[i] < prev:
        if sign == 1:
            ans += 1
            prev = A[i]
            sign = 0
            continue
        else:
            sign = -1
            prev = A[i]
            continue

print(ans)


Measured memory_bytes: 83936
package main

import (
	"fmt"
)

func main() {

	var b string
	fmt.Scan(&b)

	switch b {
	case "A":
		fmt.Println("T")
	case "T":
		fmt.Println("A")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	}
}


Measured memory_bytes: 1768
#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 A, B;
  cin >> A >> B;
  int ans;
  ans = max(A+B, max(A-B, A*B));
  cout << ans << '\n';
  return 0;
}

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

int main(){
  int N,M;
  int sum;
  int i;
  cin >> N;
  M = N;
  for(i = 1000000000;i > N;i /= 10){}
  for(;i > 0;i /= 10){
    sum += N / i;
    N %= i;
  }
  if(M % sum){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256