akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  vector<long long> a(n);
  REP(i, n) cin>>a[i];
  
  vector<long long> ta = a;
  vector<long long> ps; //10^3以下の素数全部
  for(int x = 1; x <= 1000; x++) if(prime_(x)) ps.push_back(x);
  bool pp = true;
  for(int p: ps){
    int cnt = 0;
    REP(i, n){
      bool possible = false;
      while(ta[i] % p == 0){
        possible = true;
        ta[i] /= p;
      }
      if(possible) cnt++;
    }
    if(cnt >= 2){
      pp = false;
      break;
    }
  }
  map<long long, int> mp;
  REP(i, n) mp[ta[i]]++;
  for(auto p: mp){
    if(p.first == 1LL) continue;
    if(p.second >= 2){
      pp = false;
      break;
    }
  }
  if(pp){
    cout << "pairwise coprime" << endl;
    return 0;
  }
  
  long long g;
  REP(i, n){
    if(i == 0){
      g = a[i];
    }else{
      g = gcd_(g, a[i]);
    }
  }
  if(g == 1LL){
    cout << "setwise coprime" << endl;
    return 0;
  }
  
  cout << "not coprime" << endl; 
  return 0;
}


Measured memory_bytes: 50144
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

alias A = Tuple!(int, "u", int, "v", int, "w");

void calc(int n, A[] a) {

    auto refs = new int[n];
    foreach (e; a) {
        refs[e.u]++;
        refs[e.v]++;
    }

    int leaf = -1;
    for (int i = 0; i < refs.length; i++) {
        if (refs[i] == 1) {
            leaf = i;
            break;
        }
    }

    A[][10^^5 + 10] adj;
    foreach (e; a) {
        adj[e.u] ~= e;
        adj[e.v] ~= e;
    }

    assert(leaf != -1);
    auto used = new int[n];
    auto colors = new int[n];
    void rec(int node, int color) {
        if (used[node]++) return;

        colors[node] = color;
        foreach (next; adj[node]) {
            if (next.w % 2 == 0) {
                rec(next.u, color);
                rec(next.v, color);
            }
            else {
                rec(next.u, color ^ 1);
                rec(next.v, color ^ 1);
            }
        }
    }
    rec(leaf, 0);


    for (int i = 0; i < colors.length; i++) {
        writeln(colors[i]);
    }
}

void main() {
    int n = readint;
    A[] a;
    for (int i = 0; i < n - 1; i++) {
        auto x = readints;
        a ~= A(x[0] - 1, x[1] - 1, x[2]);
    }
    calc(n, a);
}


Measured memory_bytes: 21372
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main(){
    speed;
    int cnt = 0;
    int l, r, k; cin >> l >> r >> k;
    for(int i = l; i <= r; i++) {
        if(i % k == 0) cnt++;
    }
    cout << cnt;
    return 0;
}

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

int main(){
  int h, w, flag=0;
  cin >> h >> w;
  char str[h+2][w+2];
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
	  cin >> str[i][j];
    }
  }
  for(int i=0; i<h+1; i++){
    for(int j=0; j<h+1; j++){
      if(str[i][j]=='#'){
        if(str[i-1][j]=='.'&&str[i][j-1]=='.'&&str[i+1][j]=='.'&&str[i][j+1]=='.'){
          flag++;
        } 
      }
    }
  }
  if(flag>0) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
b=[list(map(int,input().split()))for _ in range(10)]
for i in range(10):
  for j in range(10):
    for k in range(10):b[j][k]=min(b[j][k],b[j][i]+b[i][k])
c=[b[i][1]for i in range(10)]+[0]
a=0
for i in range(h):
  for j in input().split():a+=c[int(j)]
print(a)

Measured memory_bytes: 3064
import Data.List
import Control.Monad

main :: IO ()
main = do
    n <- getLine >>= return . (read :: String -> Int)
    s <- replicateM n getLine
    putStr $ unlines $ filterForSorted $ sort s

finishing :: (a,Int,[a],Int) -> [a]
finishing (xx,m,y,n)
    | m > n = [xx]
    | m < n = y
    | m == n = xx:y

filterForSorted :: [String] -> [String]
filterForSorted = finishing . foldr useForFold ("",0,[],0) 

useForFold :: Eq a => a -> (a,Int,[a],Int) -> (a,Int,[a],Int)
useForFold x (xx,m,y,n)
    | x == xx = (x,m+1,y,n)
    | m > n = (x,1,[xx],m)
    | m < n = (x,1,y,n)
    | m == n = (x,1,(xx:y),n)

Measured memory_bytes: 165884
#include <bits/stdc++.h>
using namespace std;
bool check(string S){
  if(S[0] != 'A') return false;
  int C = 0;
  for(int i = 2; i < S.length() - 1;i++){
    if(S[i] == 'C') C++;
  }
  if(C != 1) return false;
  int upper = 0;
  for(int i = 0; i < S.length(); i++){
    if(S[i] >= 'A' && S[i] <= 'Z') upper++;
  }
  if(upper != 2) return false;
  return true;
}
int main(){
  string S;
  cin >> S;
  if(check(S)){
    cout << "AC" << endl;
  }else{
    cout << "WA" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a, b, c, d, e, k;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  scanf("%d", &k);
  if(e-a<=k){
    printf("Yay!");
  }else{
    printf(":(");
  }
  return 0;
}


Measured memory_bytes: 128
/* -----------------------------------------------------------------------------
	AtCoder Beginner Contest 140
	B - Buffet
	g++ bc140B.cpp

----------------------------------------------------------------------------- */
#include <cstdio>

using namespace std;

#define MAX_N 21


/* -----------------------------------------------------------------------------
	型とクラス定義
----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
	大域データ
----------------------------------------------------------------------------- */
int A[MAX_N];
int B[MAX_N];
int C[MAX_N];


int main () {

	int N;
	int sum = 0;

	// 個数の読込み
	scanf("%d", &N);

	for(int i = 1; i <= N; i++) scanf("%d", A+i);
	for(int i = 1; i <= N; i++) scanf("%d", B+i);
	for(int i = 1; i < N; i++) scanf("%d", C+i);
	
	for(int i = 1;i <= N; i++) {
		sum += B[A[i]];
		if(i < N && A[i] + 1 == A[i+1]) sum += C[A[i]];
	}

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

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 1e6+7;
int prime[maxn];
bool is_prime[maxn];
int n,p=-1;

void Eular()
{
    for(int i=1;i<=maxn-7;i++)
        is_prime[i]=true;
    for(int i=2;i<=maxn-7;i++)
    {
        if(is_prime[i])
            prime[++p]=i;
        for(int j=0;j<=p && i*prime[j] <= maxn-7;j++)
            is_prime[i*prime[j]]=false;
    }
}

int main()
{
    Eular();
    while(~scanf("%d",&n))
    {
        int i=0,ans=0;
        while(i<=p && prime[i]<=n) i++,ans++;
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 4464
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd
readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(' ')]

MOD = 2  # type: int


def main():
    N, M = readIntN()
    ks = []
    ss = []
    for i in range(M):
        tmp = readIntN()
        ks.append(tmp[0])
        ss.append(tmp[1:])
    ps = readIntN()

    qs = [] 
    for s in ss:
        q = 0
        for c in s:
            q |= (1 << (c - 1))
        qs.append(q)

    ret = 0
    for i in range(1 << N):
        ok = True
        for q, p in zip(qs, ps):
            ok &= (bin(i & q).count('1') % MOD) == p
        if ok:
            ret += 1
    print(ret)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5380
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    ll x, y;
    cin >> x >> y;

    rep(i,0,101)
    {
        rep(j,0,101)
        {
            if (i+j == x && i*2 + j*4 == y)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


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

map<char,int> m;
int ans;
string s;

int main(){
	m['I']=1;
	m['V']=5;
	m['X']=10;
	m['L']=50;
	m['C']=100;
	m['D']=500;
	m['M']=1000;
	while(cin>>s){
		ans=0;
		for(int i=s.length()-1;i>=0;i--){
			if(i!=s.length()-1&&m[s[i]]<m[s[i+1]]){
				ans-=m[s[i]];
			}  
			else{
				ans+=m[s[i]];
			} 
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3028
//Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>	
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>
using namespace std;
#define FOR(index, start, end) for(int index = start; index < end; ++index)
#define RFOR(index, start, end) for(int index = start; index > end; --index)
#define FOREACH(itr, b) for(auto itr = b.begin(); itr != b.end(); ++itr)
#define RFOREACH(itr, b) for(auto itr = b.rbegin(); itr != b.rend(); ++itr)
#define INF 1000000000
#define M 1000000007
typedef long long ll;
typedef pair<int, int> pii;
int ans[500];
int main(void)
{
	int n, m;
	cin >> n >> m;
	FOR(i, 0, m) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		ans[a]++;
		ans[b]++;
	}
	FOR(i, 0, n) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
#define PI 3.1415926
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, p[10];
	cin >> n;
	int max = -1, sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		if(max < p[i]) max = p[i];
		sum += p[i];
	}
	cout << sum - max/2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
//library begin
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int log(int a){
    int b=a;
    int cnt=0;
    while(b%2==0){
        b/=2;
        cnt++;
    }
    return cnt;
}
//library end
string s;
int a=0;
int ans=0;
signed main(){
    cin>>s;
    int l=s.size();
    rep(i,l-1){
        if(s[i]=='A')a++;
        else if(s.substr(i,2)=="BC"){
            ans+=a;
            i++;
        }
        else a=0;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>

using namespace std;

int main(){
	int N, i;
	cin >> N >> i;

	cout << N - i + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  long long n;
  string name = "";
  char p = 'a';
  cin >> n;
  while (26 < n) {
    n--;
    name += p + (n % 26);
    n = n / 26;
  }
  name += p + (n - 1);
  reverse(name.begin(), name.end());
  cout << name << endl;
}


Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	double n,a,b;
	vector<double> v;

	while(cin>>n){
		v.push_back(n);
	}

	a=v[0];
	b=v[0];

	for(int i=0;i<v.size();i++){
		a=max(a,v[i]);
		b=min(b,v[i]);
	}

	double ans=a-b;

	cout<<ans<<endl;

}

Measured memory_bytes: 3268
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>

#define lson root << 1
#define rson root << 1 | 1

using namespace std;

const int MAXN = 5e05 + 10;
const int MAXM = 5e05 + 10;

const int INF = 0x7fffffff;

struct LinkedForwardStar {
	int to;

	int next;
} ;

LinkedForwardStar Link[MAXM << 1];
int Head[MAXN]= {0};
int size = 0;

void Insert (int u, int v) {
	Link[++ size].to = v;
	Link[size].next = Head[u];

	Head[u] = size;
}

int N, K;
int a[MAXN]= {0}, b[MAXN]= {0};

int minv[MAXN << 2];
void modify (int root, int left, int right, int posi, int value) {
	if (left == right) {
		minv[root] = value;
		return ;
	}
	int mid = (left + right) >> 1;
	if (posi <= mid) modify (lson, left, mid, posi, value);
	else modify (rson, mid + 1, right, posi, value);
	minv[root] = min (minv[lson], minv[rson]);
}
int query (int root, int left, int right, int L, int R) {
	if (L > R) return INF;
	if (L <= left && right <= R)
		return minv[root];
	int mid = (left + right) >> 1;
	int mv = INF;
	if (L <= mid) mv = min (mv, query (lson, left, mid, L, R));
	if (R > mid) mv = min (mv, query (rson, mid + 1, right, L, R));
	return mv;
}

int indeg[MAXN]= {0};
priority_queue<int, vector<int>, greater<int> > que;
int ret[MAXN]= {0}, rcnt = 0;
void topo () {
	for (int i = 1; i <= N; i ++)
		if (! indeg[i])
			que.push(i);
	while (! que.empty()) {
		int p = que.top();
		que.pop();
		ret[p] = ++ rcnt;
		for (int i = Head[p]; i; i = Link[i].next) {
			int v = Link[i].to;
			indeg[v] --;
			if (! indeg[v]) que.push(v);
		}
	}
}

int getnum () {
	int num = 0;
	char ch = getchar ();

	while (! isdigit (ch))
		ch = getchar ();
	while (isdigit (ch))
		num = (num << 3) + (num << 1) + ch - '0', ch = getchar ();

	return num;
}

int main () {
	N = getnum (), K = getnum ();
	for (int i = 1; i <= N; i ++)
		a[i] = getnum ();
	for (int i = 1; i <= N; i ++)
		b[a[i]] = i;
	memset (minv, 0x3f, sizeof (minv));
	for (int i = N; i >= 1; i --) {
		int p1 = query (1, 1, N, max (1, b[i] - K + 1), b[i] - 1);
		int p2 = query (1, 1, N, b[i] + 1, min (N, b[i] + K - 1));
		if (p1 >= 1 && p1 <= N) Insert (b[i], b[p1]), indeg[b[p1]] ++;
		if (p2 >= 1 && p2 <= N) Insert (b[i], b[p2]), indeg[b[p2]] ++;
		modify (1, 1, N, b[i], i);
	}
	topo ();
	for (int i = 1; i <= N; i ++)
		printf ("%d\n", ret[i]);

	return 0;
}

/*
4 2
4 2 3 1
*/

/*
5 1
5 4 3 2 1
*/

/*
8 3
4 5 7 8 3 1 2 6
*/

Measured memory_bytes: 28928
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
typedef long long ll;

ll gcd(ll a ,ll b){
    return b?gcd(b,a%b):a;
}

int check(ll A,ll B,ll C,ll D){
    if(A<B||D<B)return 0;
    ll g = gcd(B,D);
    if((A-C-1)/g-(A-B)/g >0)
            return 0;
        else
            return 1;

/*    A %= B;
    if(D%B == 0){
        if(A<=C)return 1;
        else return 0;
    }
    if(D>=B){
        D %= B;
        if(A<B&&A>C)return 0;
/*        while(A <= C){
            A += D;
        }*/
/*        ll temp = (C-A)/D+1;
        A = A + temp*D;
        if(A<B&&A>C)return 0;
        else return 1;
    }
*/
}

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        ll a,b,c,d;
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        if(check(a,b,c,d))printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF INT_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>w(N);
  for(int i=0;i<N;i++)cin>>w[i];

  vector<int>sum(N+1);
  sum[0]=0;
  for(int i=1;i<=N;i++)sum[i]=sum[i-1]+w[i-1];
  int ans=INF;
  for(int i=0;i<N;i++){
    int suml=sum[i];
    int sumr=sum[N]-sum[i];
    ans=min(ans,abs(sumr-suml));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);



int main()
{
    fio;
    ll n;
    cin>>n;
    ll arr[n][3];
    ll f[n][3];
    f(n){cin>>arr[i][0]>>arr[i][1]>>arr[i][2];}
    f[0][0]=arr[0][0];
    f[0][1]=arr[0][1];
    f[0][2]=arr[0][2];
    for(ll i=1;i<n;i++)
    {
        f[i][0]=arr[i][0]+max(f[i-1][1],f[i-1][2]);
        f[i][1]=arr[i][1]+max(f[i-1][0],f[i-1][2]);
        f[i][2]=arr[i][2]+max(f[i-1][0],f[i-1][1]);
    }
   // f(n){cout<<f[i][0]<<" "<<f[i][1]<<" "<<f[i][2]<<endl;}

    cout<<max(f[n-1][0],max(f[n-1][1],f[n-1][2]));


    return 0;
}


Measured memory_bytes: 8332
#include <iostream>
#include <algorithm>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

struct data_t {
    string loc;
    int score;
    int number;
};

int main()
{
    int n;
    cin >> n;
    vector<data_t> rs(n);
    for(int i = 0; i < n; ++i)
    {
        cin >> rs[i].loc >> rs[i].score;
        rs[i].number = i+1;
    }
    sort(begin(rs), end(rs), [](const data_t& x, const data_t& y){
        if(x.loc != y.loc) return x.loc <= y.loc;
        return x.score > y.score;
    });
    for(const auto& r : rs)
    {
        cout << /*r.loc << ' ' << r.score << ' ' <<*/ r.number << '\n';
    }
    return 0;
}


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


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

  int n,m,c;
  cin >> n >> m >>c;
  int b[m];
  rep(i,m) cin >> b[i];
  int a[n][m];
  rep(i,n) rep(j,m) cin>>a[i][j];
  int ans=0;
  rep(i,n){
    int sum=c;
    rep(j,m){
      sum+=a[i][j]*b[j];
    }
    if(sum>0) ans++;
  }
  cout << ans << endl;
  
  return 0;
    

}


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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	while (A > 0 && C > 0) {
		C -= B;
		A -= D;
	}

	if (C > 0) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}

	return 0;

}


Measured memory_bytes: 3596
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
a=list(map(int,input().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

divs=make_divisors(sum(a))
# print(divs)
ans=1
for i in range(len(divs)):
    r=[]
    d=divs[i]
    for j in range(n):
        if a[j]%d!=0:
            r.append(a[j]%d)
    r.sort()

    ruir=ruiseki(r)
    # print(d,ruir)
    # print(r)
    if ruir==[0]:
        ans=d
    for i in range(len(r)):
        hiku=ruir[i]
        tasu=-(ruir[-1]-ruir[i])+d*(len(r)-i)
        # print(hiku,tasu,ruir[-1]-ruir[i])
        if hiku%d==tasu%d and max(hiku,tasu)<=k:
            ans=d

print(ans)

Measured memory_bytes: 42588
#include <stdio.h>
 
int main() {
    int n, mini, tmp, flag1, flag2;
    char tmp_c;
    char card[3];
    scanf("%d", &n);
 
    char chars1[n+1];
    int nums1[n+1];
    char chars2[n+1];
    int nums2[n+1];
    int indexes1[n+1];
    int indexes2[n+1];
 
    for (int i=0; i<n; i++) {
      scanf("%3s", card);
      chars1[i] = card[0];
      nums1[i] = card[1] - '0';
      chars2[i] = chars1[i];
      nums2[i] = nums1[i];
      indexes1[i] = i;
      indexes2[i] = i;
    }
 
    flag1 = 0;
    for (int i=0; i<n; i++) {
        for (int j=n-1; j>i; j--) {
            if (nums1[j] < nums1[j-1]) {
                tmp = nums1[j];
                nums1[j] = nums1[j-1];
                nums1[j-1] = tmp;
 
                tmp_c = chars1[j];
                chars1[j] = chars1[j-1];
                chars1[j-1] = tmp_c;
                
                tmp = indexes1[j];
                indexes1[j] = indexes1[j-1];
                indexes1[j-1] = tmp;
            }
        }
    }
 
    for (int i=0; i<n-1;i++) {
        if (i!=0) printf(" ");
        printf("%c%d", chars1[i], nums1[i]);
        flag1 |= (nums1[i] == nums1[i+1] && indexes1[i] > indexes1[i+1]);
    }
    
    printf(" %c%d", chars1[n-1], nums1[n-1]);
 
    if (flag1) {
        printf("\nNot stable\n");
    } else {
        printf("\nStable\n");
    }
 
    flag2 = 0;
    for (int i=0; i<n; i++) {
        int j;
        mini = i;
        for (j=i; j<n; j++) {
            if (nums2[j] < nums2[mini]) {
                mini = j;
            }
        }

        tmp = nums2[i];
        nums2[i] = nums2[mini];
        nums2[mini] = tmp;
 
        tmp_c = chars2[i];
        chars2[i] = chars2[mini];
        chars2[mini] = tmp_c;

        tmp = indexes2[i];
        indexes2[i] = indexes2[mini];
        indexes2[mini] = tmp;
    }
 
    for (int i=0; i<n-1;i++) {
        if (i!=0) printf(" ");
        printf("%c%d", chars2[i], nums2[i]);
        flag2 |= (nums2[i] == nums2[i+1] && indexes2[i] > indexes2[i+1]);
    }
    
    printf(" %c%d", chars2[n-1], nums2[n-1]);
 
    if (flag2) {
        printf("\nNot stable\n");
    } else {
        printf("\nStable\n");
    }
 
}


Measured memory_bytes: 2708
fun main(args: Array<String>) {
    var (count) = readLine()!!.split(" ").map { it.toInt() }
    val values = readLine()!!.split(" ").map { it.toLong() }

    val minusCount = values.filter { it < 0 }.size
    val zeroCount = values.filter{ it == 0L }.size

    val flagCanAllPlus = zeroCount > 0 || minusCount % 2 == 0

    val flatValues = values.map { if (it < 0) -it else it }.sorted()

    val res = if (flagCanAllPlus) flatValues.sum() else flatValues.sum() - flatValues[0] * 2

    print(res)
}


Measured memory_bytes: 74816
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;
typedef long long ll;

int main() {
    ll n,m;
    cin >> n >> m;
    ll mn = min(n,m);
    ll mx = max(n,m);
    if(mn == 1){
        if(mx == 1) cout << 1 << endl;
        else cout << mx-2 << endl;
    }
    else cout << (m-2)*(n-2) << endl;
}

Measured memory_bytes: 256
import sys
import copy

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
P = list(map(float, readline().split()))


def solve():
    dp = [0.0] * (N + 1)
    dp[0] = 1.0 - P[0]
    dp[1] = P[0]
    for i in range(1, N):
        ndp = [0.0] * (N + 1)
        p = P[i]
        for j in range(i, -1, -1):
            ndp[j + 1] += dp[j] * p
            ndp[j] += dp[j] * (1 - p)
        dp = ndp
    return sum(dp[N // 2 + 1 :])


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 43116
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define endl '\n'
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end() 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

vector<pair<int, int>> tree;
vector<int> arr;
pair<int, int> qans(MP(-inf, -inf));

void build (int l, int r, int node) {
	if (l == r) {
		tree[node].first = arr[l];
		tree[node].second = -inf;
		return;
	} 
	int mid = (l + r) / 2;
	build(l, mid, 2 * node + 1);
	build(mid + 1, r, 2 * node + 2);
	vi te;
	te.push_back(tree[2 * node + 1].first);
	te.push_back(tree[2 * node + 2].first);
	te.push_back(tree[2 * node + 1].second);
	te.push_back(tree[2 * node + 2].second);

	sort(all(te));
	reverse(all(te));
	tree[node].first = te[0];
	tree[node].second = te[1];
}

void update (int l, int r, int node, int idx, int x) {
	if (l > idx or r < idx) return;
	if (l == r) {
		tree[node].first = x;
		tree[node].second = -inf;
		return;
	}
	int mid = (l + r) / 2;
	update (l, mid, 2 * node + 1, idx, x);
	update (mid + 1, r, 2 * node + 2, idx, x);
	vi te;
	te.push_back(tree[2 * node + 1].first);
	te.push_back(tree[2 * node + 2].first);
	te.push_back(tree[2 * node + 1].second);
	te.push_back(tree[2 * node + 2].second);

	sort(all(te));
	reverse(all(te));
	tree[node].first = te[0];
	tree[node].second = te[1];
}

void query (int l, int r, int node, int lu, int ru) {
	if (l > lu or r < lu) return;
	if (l >= lu and r <= ru) {
		vi te;
		te.push_back(qans.first);
		te.push_back(qans.second);
		te.push_back(tree[node].first);
		te.push_back(tree[node].second);

		sort(all(te));
		reverse(all(te));
		qans.first = te[0], qans.second = te[1];
		return;
	}
	int mid = (l + r) / 2;
	query (l, mid, 2 * node + 1, lu, ru);
	query (mid + 1, r, 2 * node + 2, lu, ru);
}
signed main () {
	start_routine;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif

	int n;
	cin >> n;

	for (int i = 0; i <= 100; i += 1) {
		for (int j = 0; j <= 100; j += 1) {
			if (i * 4 + j * 7 == n) {
				exit("Yes", 0);
			}
		}
	}
	exit("No", 0);
	end_routine;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 100002
using namespace std;
bool solve(string s){
	int n = s.size();
	for(int i=0;i<n;i++){
		if(i&1){
			if(!(s[i]=='L' or s[i]=='U' or s[i]=='D')) return false;
		}
		else{
			if(!(s[i]=='R' or s[i]=='U' or s[i]=='D')) return false;
		}
	}
	return true;
}
int main() {
	// your code goes here
	string s; 
	cin>>s;
	printf("%s\n", solve(s) ? "Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename T, typename Can> T bsearch(T L, T R, Can&& can, bool left_feasible = true) {
    static_assert(is_convertible<decltype(can), function<bool(T)>>::value, "can must be bool(T)");
    T& feasible = left_feasible ? L : R;
    T& infeasible = left_feasible ? R : L;
    while(R - L > 1) {
        T M = L + (R - L) / 2;
        (can(M) ? feasible : infeasible) = M;
    }
    return feasible;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> h(n);
    cin >> h;
    cout << bsearch<ll>(0, 1'000'000'000, [&](ll k) {
        ll tot = 0;
        for(int hi : h) {
            tot += (max(0ll, hi - k * b) + (a - b) - 1) / (a - b);
        }
        return tot <= k;
    }, false) << endl;
    return 0;
}


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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] + n <= 90){
            s[i] += n;
        }else{
            int m = s[i] + n - 90;
            s[i] = 64 + m;
        }
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forn(i,a,n) for(int i =a;i < n; i++)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double Double;
#define MAXN 3005
Double dp[MAXN][MAXN];
int used[MAXN][MAXN];
Double p[MAXN];
int n;

Double solve(int pos, int h){
	if(pos == n){
		if(h >= (n+1)/2){
			return 1.0;
		}
		return 0.0;
	}
	if(used[pos][h]) return dp[pos][h];
	used[pos][h] = 1;
	Double ans = (solve(pos+1,h+1) * p[pos]) + (solve(pos+1,h) * (1.0 - p[pos]));
	return dp[pos][h] = ans;
}

int main(){__
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> p[i];
	}
	cout << fixed << setprecision(10) << solve(0,0) << endl;
}


Measured memory_bytes: 104960
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

  int N; cin >> N;
  int A = 0, B = 0, C = 0;
  int ans = 0;
  rep(i, N) {
      string s;
      cin >> s;
      rep(j, s.size() - 1) {
          if(s[j] == 'A' && s[j + 1] == 'B') ans ++;
      }
      if(s[0] == 'B') B ++;
      if(s[s.size() - 1] == 'A') A++;
      if(s[0] == 'B' && s[s.size() - 1] == 'A') C ++;
  }
  B -= C;
  A -= C;
  
  if(C != 0) {
      ans += C - 1;
      if(A >= 1) {
      ans ++;
      A --;
  }
  if(B >= 1) {
      ans ++;
      B --;
  }
  }
  ans += min(A, B);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include"stdio.h"
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
class Tree
{
public:
	queue <int> Pre;
	vector <int> In;
	vector <int> Post;
	void Reconstruction(int L, int R)
	{
		if (L >= R);
		else
		{
			int c = Pre.front();
			Pre.pop();
			int m = distance(In.begin(), find(In.begin(), In.end(), c));
			Reconstruction(L, m);
			Reconstruction(m + 1, R);
			Post.push_back(c);
		}
	}
};

int main()
{
	Tree T;
	int n,t;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &t);
		T.Pre.push(t);
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &t);
		T.In.push_back(t);
	}
	T.Reconstruction(0, n);
	for (int i = 0; i < n-1; i++)
	{
		printf("%d ", T.Post[i]);
	}
	printf("%d\n", T.Post[n - 1]);
	return 0;
}

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

class Program
{
    static void Swap(string[] A, int from, int to)
    {
        string temp = A[from];
        A[from] = A[to];
        A[to] = temp;
    }

    static void BubbleSort(string[] ary)
    {
        bool swapped = true;
        while (swapped)
        {
            swapped = false;
            for (int i = 0; i < ary.Length - 1; i++)
            {
                if (ary[i].Substring(1, 1)[0] > ary[i + 1].Substring(1, 1)[0])
                {
                    swapped = true;
                    Swap(ary, i, i + 1);
                }             
            }
        }
    }

    static void SelectionSort(string[] A)
    {
        for (int i = 0; i < A.Length; i++)
        {
            int minidx = i;
            for (int j = i; j < A.Length; j++) minidx = (A[j].Substring(1, 1)[0] < A[minidx].Substring(1, 1)[0])? j: minidx;
            Swap(A, i, minidx);
        }
    }

    static bool isSame(string[] A, string[] B)
    {
        if (A.Length != B.Length) return false;
        for (int i = 0; i < A.Length; i++)
        {
            if (A[i] != B[i]) return false;
        }
        return true;
    }

    static void OutputArray(string[] A)
    {
        for (int i = 0; i < A.Length - 1; i++) Console.Write("{0} ", A[i]);
        Console.WriteLine(A[A.Length - 1]);
    }

    public static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] A = Console.ReadLine().Split(' ');
        string[] B = new string[N];
        string[] C = new string[N];
        A.CopyTo(B, 0);
        A.CopyTo(C, 0);
        BubbleSort(B);
        SelectionSort(C);
        OutputArray(B);
        Console.WriteLine((isSame(B, B))? "Stable": "Not stable");
        OutputArray(C);
        Console.WriteLine((isSame(B, C))? "Stable": "Not stable");
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  if(s.size() == 2) cout << s << '\n';
  else{
    reverse(s.begin(), s.end());
    cout << s << '\n';
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>

#include <typeinfo>

using namespace std;

int main(){
  int a,b,c;
  cin >> a;
  int counter = 1;
  int summing = 0;
  for(int i = 0;i< a;++i){
    summing += counter;
    counter += 1;
  }
  cout << summing << endl;
  return 0;
}


Measured memory_bytes: 256
/*
                    Author: Ankit Kaul
    **********************Code Belongs to Respective Author Only************************************
    */
    /*#pragma GCC optimize("O3")
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
    #include <bits/stdc++.h>
    #define endl       '\n'
    #define PI          3.141592653589
    #define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define M           1000000007
    #define int         long long int
    #define inf         INT_MAX
    #define pb          emplace_back
    #define pf          emplace_front
    #define pii         pair<int,int>
    #define vi          vector<int>
    #define vii         vector<pii>
    #define mi          map<int,int>
    #define mii         map<pii,int>
    #define all(a)      (a).begin(),(a).end()
    #define rall(a)     (a).rbegin(),(a).rend()
    using namespace std;
    int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
    int power(int x,int n){
        int result=1;
        while(n>0)
        {   if(n % 2 ==1)
            result=(result * x) % M;
            x=(x*x)% M;
            n=n/2;
        }
    return result % M;
    }      
    bool isPrime(int n) 
    { 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
    } 
int dp[200001],gp[200001];
int inv(int a)
{   return power(a,M-2);
}
void ncr(int n,int r)
{   dp[0]=1;
    for(int i=1;i<=r;i++)
    dp[i]=(dp[i-1]*i)%M;
    gp[n]=inv(dp[n]);
    for(int i=n;i>0;i--)
    gp[i-1]=(gp[i]*i)%M;
}
signed main()
{   jaldi
    int n,k,sum=0,q;
    cin>>n>>k;
    q=k;
    k=min(n,k);
    ncr(n,n);
    int x=dp[n],y=dp[n-1];
    for(int i=0;i<=k;i++)
    {   int z=gp[i]%M;
        int a=gp[n-i]%M;
        int aa=(((x*z)%M)*a)%M;
        int b=gp[n-i-1]%M;
        int bb=gp[i]%M;
        bb=(((y*b)%M)*bb)%M;
        sum=(sum+(bb*aa)%M)%M;
    }
    cout<<(sum)%M;
}   


Measured memory_bytes: 3328
#include <bits/stdc++.h>
		using namespace std;
		typedef long long ll;
		#define PI 3.14159265358979
		#define EPS 1e-8
		#define mod  998244353
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"
			 
		const ll INF=1e15;	
		const int N=2e5+50;
		 

		 
		long long binpow(long long a, long long b, long long m) {
			a %= m;
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = res * a % m;
				a = a * a % m;
				b >>= 1;
			}
			return res;
		}
		
		ll modinverse(ll a,ll m)
		{
			return binpow(a,m-2,m);
		}
		
			
		
		
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);cout.tie(0);
		
					
			ll n,m;
			cin>>n>>m;
			
			
			vector<ll> a(m+1,0),b(m+1,0);
			
			for(ll i=1;i<=m;i++)
			{
				ll b1;
				cin>>a[i]>>b1;
				ll tot=0;
				for(ll j=0;j<b1;j++)
				{
					ll c;
					cin>>c;
					tot|=(1LL<<(c-1));
				}
				
				b[i]=tot;
			}
			
			ll dp[(1LL<<12)];
			
			for(ll i=0;i<(1LL<<12);i++)
			{
				dp[i]=INF;
			}
			
			dp[0]=0;
			
			for(ll i=0;i<(1LL<<n);i++)
			{
				if(dp[i]==INF)
					continue;
				for(ll j=1;j<=m;j++)
				{
						dp[i|b[j]]=min(dp[i|b[j]],dp[i]+a[j]);
					
				}
			}
			
			ll ans=dp[(1LL<<n)-1];
			
			if(ans==INF)
				cout<<-1;
			else
				cout<<ans;
			
		}
			
			
		


Measured memory_bytes: 3708
//おまじないc++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int main() {
	 int n;
	cin >> n;
		
	vector<int>  a(n);
		
	for (int i = 0; i < n; i++) {
			cin >> a.at(i);
		
	}
	 int an = 0;
	rep(i, n) {
		if (a.at(i) == an+1) {
			an++;
		}

	}
	if(an==0){
      cout<<-1;
    }
  else{
  cout << n - an;
 }
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		while(true) {
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		
		if(a==-1 && b==-1 && c==-1) {
			break;
		}else if(a==-1 || b==-1 ) {
			System.out.println("F");
		}else if(a+b >= 80) {
			System.out.println("A");
		}else if(a+b >=65 ) {
			System.out.println("B");
		}else if(a+b>=50) {
			System.out.println("C");
		}else if(a+b >=30 ) {
			if(c >= 50) {
				System.out.println("C");
			}
			else
				System.out.println("D");
		}else if(a+b<30) {
			System.out.println("F");
		}
		}
		scan.close();
}
}


Measured memory_bytes: 26248
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int rankA = getRank(a), rankB = getRank(b);
			System.out.println((rankA == rankB) ? "Draw" : (rankA > rankB) ? "Alice" : "Bob");
		}
	}

	/**
	 * @param n 入力カード
	 * @return 入力カードのランク
	 */
	private static int getRank(int n) {
		return (n + 11) % 13;
	}
}


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

const ll MOD = 1e9+7;

ll repsq(ll n,ll p){
    if(p == 0) return 1;
    if(p & 1) return (n * repsq(n,p-1)) % MOD;
    else {
        ll t = repsq(n,p/2) % MOD;
        return (t * t) % MOD;
    }
}

int main(){
    ll n,a,b;cin>>n>>a>>b;
    ll ans = (repsq(2,n) - 1) % MOD;

    ll x_a = 1,x_b = 1;
    ll y_a = 1,y_b = 1;
    ll dis_a = 1,dis_b = 1;

    for(ll i=0;i<a;i++){
        x_a *= (n-i);
        x_a %= MOD;
        y_a *= (1+i);
        y_a %= MOD;
    }
    dis_a = x_a * repsq(y_a,MOD-2) % MOD;

    for(ll i=0;i<b;i++){
        x_b *= (n-i);
        x_b %= MOD;
        y_b *= (1+i);
        y_b %= MOD;
    }
    dis_b = x_b * repsq(y_b,MOD-2) % MOD;

    ans = (ans - dis_a + MOD) % MOD;
    ans = (ans - dis_b + MOD) % MOD;

    cout<< (ans + MOD) % MOD <<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  
  int arr[n];
  
  for(int i=0;i<n;i++)
  {
     cin>>arr[i];
  }
  
  double sum=0.0;
  for(int i=0;i<n;i++)
  {
     double l=(double)1/((double) arr[i]);
     
     sum+=l;
  }
  double ans=(double)1/sum;
  cout<<ans<<endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
using namespace std;


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

    int ans = 0;
    int prev = 0;
    stack <int> st;
    st.push(S[0]);
   for(int i = 1; i < S.size(); i++){
       if(!st.empty() && S[i] != st.top()){
           ans += 2;
           st.pop();
       } else {
           st.push(S[i]);
        }   
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define F first
#define S second
vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}

int main() {
    Int a, b;
    cin >> a >> b;
    Int ans;
    if (a==1 || b==1) {
        ans = 1;
    }
    else if (a * b % 2 == 0) {
        ans = a * b / 2;
    } else {
        ans = a * b / 2 + 1;
    }
    PUTS(ans)
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long

ll t;
ll n;

int main() {
	scanf("%d", &t);
	ll total = 0;

	for(ll i = 1; i <= t; i++) {
		if(i % 3 != 0 && i % 5 != 0) {
			total += i;
		}
	}

	printf("%lld\n", total);
	return 0;
}

Measured memory_bytes: 1732
#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>;

ll nCr(ll n, ll r) {
    ll a = 1;
    for (ll i = 1; i <= r; i++) {
       a *= n--;
       a /= i;
    }
    return a;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if (a > b || (n == 1 && (b - a) > 0)) {
        cout << 0 << endl;
        return 0;
    }

    cout << (b - a) * (n - 2) + 1 << endl;
    return 0;
}

Measured memory_bytes: 3636
// atcoder/code-festival-2017-quala/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int n, m, k;
  while (cin >> n >> m >> k) {
    bool f = false;
    for (int i = 0; i <= n; ++i) {
      for (int j = 0; j <= m; ++j) {
        int a = i * (m - j);
        int b = (n - i) * j;
        if (a + b == k) f = true;
      }
    }
    cout << (f ? "Yes" : "No") << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
e_list = [[] for i in range(N)]
for i in range(M):
    a,b = map(lambda x:int(x)-1, input().split())
    e_list[a].append(b)
    e_list[b].append(a)
bin_or_not = True
ans = (N-1)*N//2 - M
w_or_b = [-1]*N
stack = [0]
w_or_b[0] = 0
while stack:
    x = stack.pop()
    for i in e_list[x]:
        if w_or_b[i] >= 0:
            bin_or_not = w_or_b[x]^w_or_b[i]
        else:
            w_or_b[i] = (w_or_b[x] + 1)%2
            stack.append(i)
        if not bin_or_not:
            break
    if not bin_or_not:
        break
if bin_or_not:
    w =  w_or_b.count(0)
    b = w_or_b.count(1)
    ans = w*b - M
print(ans)

Measured memory_bytes: 22064
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

S = str(input())

if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT':
    print(1)
else:
    pass

Measured memory_bytes: 38384