akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for ( int i = 0; i < N; ++i){
        cin >> S.at(i);
    }
    
    sort(S.begin(), S.end());
    
    int ans = 1;
    
    if ( N == 1 ){
        ans = 1;
    } else {
        for ( int i = 0; i < N-1; ++i){
            if ( S.at(i) != S.at(i+1) ){
                ans += 1;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 9596
import java.util.Scanner;

class Main
{
public static void main(String[] args)
{
	Scanner scan = new Scanner(System.in);
	
	int[] x = new int[10002];
	int i;
	int a;
	
	for (i=0; i<10002; i++){
		x[i] = 0;}
	
	for (i=1; i<10002; i++){
		x[i] = scan.nextInt();
		if (x[i]==0){
			break;}}
			
	for (int q=1; q<i; q++){
		System.out.println("Case "+q+": "+x[q]);}
	}
}


Measured memory_bytes: 42988
N=(int)(input())
max=0
now=[0,0]
for i in range(0,N):
    data=(input()).split(' ')
    if(max<(int)(data[0])):
        now[0]=data[0]
        now[1]=data[1]
        max=(int)(data[0])
print((int)(now[0])+(int)(now[1]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int A;
  cin >> A;
  char b;
  cin >> b;
  int C;
  cin >> C;
  
  if(b == '+'){
    cout << A + C << endl;
  }
  if(b == '-'){
    cout << A - C << endl;
  }
}

Measured memory_bytes: 256
// ABC059
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

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

typedef long long ll;

void f()
{
    string A, B;
    cin >> A >> B;

    if(A.size() > B.size()) cout << "GREATER" << endl;
    else if(A.size() < B.size()) cout << "LESS" << endl;
    else
    {
        int i;
        rep(i, A.size())
        {
            if(A[i] > B[i])
            {
                cout << "GREATER" << endl;
                return;
            }
            else if(A[i] < B[i])
            {
                cout << "LESS" << endl;
                return;
            }
        }
        cout << "EQUAL" << endl;
    }
}

int main()
{
    f(); 

    return 0;
}


Measured memory_bytes: 256
s = input().replace("RL","R,L").replace("LR","L,R").split(",")
s = s[::-1]
h = list()
while s:
    a = len(s.pop())
    b = len(s.pop())
    h.append((a,b))

t = []
for x,y in h:
    t += [0]*(x-1) + [(x+1)//2+y//2,x//2+(y+1)//2] + [0]*(y-1)

print(" ".join(map(str,t)))

Measured memory_bytes: 13884
N,M = map(int,input().split())
A = [input().strip() for i in range(N)]
B = [input().strip() for i in range(M)]

agree = False
for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            if A[i+k][j:j+M] != B[k]:
                break
        else:
            agree = True
            break
    if agree:
        break
if agree:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		int inNum = 0;
		int count = 0;
		Scanner sc = new Scanner(System.in);	
		do {
			inNum = sc.nextInt();
			if (inNum < 0 || inNum > 10000) {
				System.err.println("Err!");
				return;
			}
			list.add(new Integer(inNum));
			count++;
			// 0が入力されたかデータセットが１万件に達したら入力終了
		 } while (inNum != 0 || count == 10000);
		 
		 for (int i = 1; i < list.size(); i++) {
		 	System.out.printf("Case " + i + ": " + list.get(i-1) + "%n");
		 }
		
	}
}


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

int main(){
  int k,x;
  cin >> k >> x;
  for(int i=x-k+1;i<x+k;i++)
    cout << i << " ";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  int smallest_so_far = n+1;
  int ans=0;
  for(int i=0;i<n;i++) {
    if(smallest_so_far > a[i]) {
      ans++;
      smallest_so_far = a[i];
    }
  }
  cout << ans << "\n";
}

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

using namespace std;

int main(){
	int sx, sy, tx, ty;
	string ans = "";
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx, dy = ty - sy;
	for(int i = 0; i < dy; i++){
		ans += "U";
	}
	for(int i = 0; i < dx; i++){
		ans += "R";
	}
	for(int i = 0; i < dy; i++){
		ans += "D";
	}
	for(int i = 0; i < dx; i++){
		ans += "L";
	}
	ans += "L";
	for(int i = 0; i < dy + 1; i++){
		ans += "U";
	}
	for(int i = 0; i < dx + 1; i++){
		ans += "R";
	}
	ans += "DR";
	for(int i = 0; i < dy + 1; i++){
		ans += "D";
	}
	for(int i = 0; i < dx + 1; i++){
		ans += "L";
	}
	ans += "U";
	cout << ans << endl;
	return 0;
}

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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
  string s,t; cin >> s >> t;
  int n = s.size();
  int ans = 0;
  rep(i,n){
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3932
#include<bits/stdc++.h>
#define int long long
using namespace std;

map<int, int>mp;

signed main()
{
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    bool zero = true;
    for(int i = 0; i < n; ++i)
        zero &= (a[i] == 0);

    if (n % 3 != 0 && !zero)
    {
        cout << "No";
        return 0;
    }
    if (zero)
    {
        cout << "Yes";
        return 0;
    }
    int d = 0;
    for(int i = 0; i < n; ++i)
    {
        if (!mp[a[i]])
            ++d;
        mp[a[i]]++;
    }
    if (d > 3)
    {
        cout << "No";
        return 0;
    }
    vector<pair<int, int> >v;
    for(auto i : mp)
        v.push_back(make_pair(i.first, i.second));
    //assert(v.size() != 2);
    if (v.size() == 3)
    {
        for(int i = 0; i < 3; ++i)
            if (v[i].second != n / 3)
            {
                cout << "No";
                return 0;
            }
        if ((v[0].first ^ v[2].first ^ v[1].first) == 0)
        {
            cout << "Yes";
            return 0;
        }
        cout << "No";
        return 0;
    }
    if (v.size() == 2)
    {
        if ((v[0].second == n / 3 && v[0].first == 0) || (v[1].second == n / 3 && v[1].first == 0))
        {
            cout << "Yes";
            return 0;
        }
        else
        {
            cout << "No";
            return 0;
        }
    }
    if (v.size() == 1)
    {
        cout << "No";
        return 0;
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 5632
#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>;
#define chmax(x,y) x = max(x,y)
 
const ll INF = 1e18;
 
ll dp[200005][4];
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int k = 1+n%2;
  rep(i,n+1)rep(j,k+1) dp[i][j] = -INF;
  dp[0][0] = 0;
  rep(i,n) {
    rep(j,k+1) {
      chmax(dp[i+1][j+1], dp[i][j]);
      ll now = dp[i][j];
      if ((i+j)%2 == 0) now += a[i];
      chmax(dp[i+1][j], now);
    }
  }
  ll ans = dp[n][k];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10384
import qualified Data.Map as M
f m x = M.unionWith (+) m (M.mapKeysMonotonic (x+) m)
main = do [n,a] <- fmap (map read . words) getLine
          xs <- fmap (map (subtract a . read) . words) getLine
          print $ foldl f (M.singleton 0 1) xs M.! 0 - 1

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> a[i];
  }

  cout << *max_element(ALL(a)) - *min_element(ALL(a));
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3584
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-7;
const double PI  = acos(-1.0);

int dx[]={-1,0,1,1,1,0,-1,-1};
int dy[]={-1,-1,-1,0,1,1,1,0};
int main(){
	int h,w;
	while(cin>>h>>w,h|w){
		vs f(h);
		REP(i,h){
			cin>>f[i];
		}

		map<string,int> m;
		string ans;
		REP(i,h){
			REP(j,w){
				REP(d,8){
					vvi used(h,vi(w));
					string s;
					int y=i,x=j;
					while(1){
						if(!used[y][x]){
							s+=f[y][x];
							used[y][x]=1;
							y+=dy[d];
							x+=dx[d];
							if(y<0)y=h-1;
							if(x<0)x=w-1;
							if(y>=h)y=0;
							if(x>=w)x=0;
						}else{
							break;
						}
						if(s.size()>1){
							if(!EXIST(m,s)){
								m[s]=0;
							}
							m[s]++;
							if(m[s]>1&&(s.size()>ans.size()||(s.size()==ans.size()&&s<ans))){
								ans=s;
							}
						}
					}
				}
			}
		}

		cout<<(ans==""?"0":ans)<<endl;
	}
}

Measured memory_bytes: 36044
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n-r+1;
	int sum = 1;
	for(int i =s;i<=n;i++)
		sum *= i;
	return sum;
}
//int nCr1(int n, int r)
//int nCr2(int n, int r) 
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int x, y,z=0;
	cin >> x >> y;
	if (x == 1 && y == 1)
		cout << 1000000;
	else
		cout << max(z, 100000 * (4 - x)) + max(z, 100000 * (4 - y));
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<queue>
#include<tuple>
#include<map>//map<char,char> a["a"]="a"
#include<limits>//ex numeric_limits<int>::max()
#include<math.h>
#define llong long long
#define INF 999999999

using namespace std;

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

    string s;
    llong k;
    cin >>s>>k;

    int i=0;
    for (; i < s.size(); ++i)
    {
        if(s[i]!='1')break;
        if(i+1==k){cout<<1<<endl;return 0;}
    }
    cout << s[i]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include<iomanip>
using namespace std;
using P = pair<int, int>;

int main()
{
	int N, K;
	int H[200010];
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	sort(H, H + N);
	long long int ans = 0;
	for (int i = N - 1; i >= 0; i--) {
		if (K > 0) {
			K--;
		}
		else {
			ans += H[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

int main(){
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << (X - Z) / (Y + Z) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        ll t = (i + 1) * i / 2;
        if (N <= t) {
            std::cout << i << '\n';
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int a,b;
    cin>>a>>b;
    if(b==1)cout<<0<<endl;
    else cout<<(b-2)/(a-1)+1<<endl;
}


Measured memory_bytes: 256
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>  
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vl vector<ll>
#define mod 1000000007


int main()
{
    ll n;cin>>n;
    ll a[n];
    ll ans=0;
    for(ll i=0;i<n;i++)
    cin>>a[i];
    for(ll i=1;i<n;i++)
    {
        if(a[i]<a[i-1])
        {
            ans+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  int a[3];
  a[0]=1;
  a[1]=0;
  a[2]=0;
  char s[3];
  while(~scanf("%s",s)){
    if(s[0]=='Z')break;
    int xx = s[0]-'A';
    int yy = s[2]-'A';
    swap(a[xx],a[yy]);
  }
  if(a[0])cout<<"A"<<endl;
  else if(a[1])cout<<"B"<<endl;
  else cout<<"C"<<endl;
  return 0;
}

Measured memory_bytes: 1152
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let mut s: Vec<_> = get_word().chars().collect();;
    let t: Vec<_> = get_word().chars().collect();;
    for _ in 0 .. s.len() {
        if s == t {
            println!("Yes");
            return;
        }
        let mut u = s[1..].to_vec();
        u.push(s[0]);
        s = u;
    }
    println!("No");
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline vi32 plist(i32 n) { vi32 f(n, 1); f[0] = f[1] = 0; repi(i, 2, n) for (int j = i * 2; j < n; j += i) f[j] = 0; return f; }
inline bool isprime(i32 n) { if (n < 2) return 0; for (i32 i = 2; i * i <= n; i++) if (n % i == 0) return 0; return 1; }
template<class T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<class T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<class T> inline bool amax(T &x, T y) { if (x >= y) return 0; x = y; return 1; }
template<class T> inline bool amin(T &x, T y) { if (x <= y) return 0; x = y; return 1; }
template<class T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }

template<class T> struct flow {
  struct edge {
    int to;
    T cap;
    int rev;
  };

  int n, s, t;
  vector<vector<edge>> g;
  vector<bool> used;

  flow(int n, int s, int t) : n(n), s(s), t(t) {
    g = vector<vector<edge>>(n);
  }

  void add(int from, int to, T cap) {
    g[from].push_back({ to, cap, (int) g[to].size() });
    g[to].push_back({ from, 0, (int) g[from].size() - 1 });
  }

  T dfs(int v, T f) {
    if (v == t) {
      return f;
    }
    used[v] = true;
    for (auto &e : g[v]) {
      if (used[e.to] || e.cap <= 0) {
        continue;
      }
      T d = dfs(e.to, min(f, e.cap));
      if (d > 0) {
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
      }
    }
    return 0;
  }

  T max_flow() {
    T sum = 0;
    while (true) {
      used = vector<bool>(n);
      T f = dfs(s, numeric_limits<T>::max());
      if (f == 0) {
        break;
      }
      sum += f;
    }
    return sum;
  }
};

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int s = 0, t = n + 1;
  long long sum = 0;
  flow<long long> f(n + 2, s, t);
  for (int i = 0; i < n; i++) {
    if (a[i] < 0) {
      f.add(s, i + 1, -a[i]);
      f.add(i + 1, t, 0);
    } else {
      f.add(i + 1, t, a[i]);
      sum += a[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + i; j <= n; j += i) {
      f.add(i, j, numeric_limits<i64>::max());
    }
  }
  cout << sum - f.max_flow() << endl;
  return 0;
}


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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

int main()
{
	std::ios_base::sync_with_stdio(0);
	
	u32 n;

	std::cin >> n;
	
	bool ok = false;

	for(u32 i=1; i<10; i++)
	{
		if(n%i==0 && u32(n/i) < 10)
		{
			ok = true;
		}
	}

	std::cout << (ok? "Yes" : "No") << "\n";
	
	return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
else:
    P = list(map(int, input().split()))
    for i in range(100):
        if x-i in P:
            pass
        else:
            print(x-i)
            exit()
        if x+i in P:
            pass
        else:
            print(x+i)
            exit()

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int N, count = 1, now;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 1; i < N; i++) {
        if (i == 1) {
            if (A.at(i - 1) < A.at(i)) {
                now = 1;
            }
            else if (A.at(i - 1) == A.at(i)) {
                now = 0;
            }
            else {
                now = -1;
            }
            continue;
        }
        if (now == 0) {
            if (A.at(i - 1) < A.at(i)) {
                now = 1;
            }
            else if (A.at(i - 1) > A.at(i)) {
                now = -1;
            }
        }
        else if (now == 1) {
            if (A.at(i - 1) > A.at(i)) {
                now = 0;
                count++;
            }
        }
        else if (now == -1) {
            if (A.at(i - 1) < A.at(i)) {
                now = 0;
                count++;
            }
        }
    }
    cout << count << endl;
}


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

int main()
{
    int n;
    cin>>n;
    int m=n%10;
    if(m==2||m==4||m==5||m==7||m==9)
    cout<<"hon"<<endl;
    if(m==0||m==1||m==6||m==8)
    cout<<"pon"<<endl;
    if(m==3)
    cout<<"bon"<<endl;

    return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;

/**
 *
 * @author sysPlan3
 */
public class Main {

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

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if (a > b) {
            System.out.println("a > b");
        } 
        if (a < b) {
            System.out.println("a < b");
        } 
        if(a==b){
            System.out.println("a == b");
        }

    }

} 

Measured memory_bytes: 26028
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    long long int q,h,s,d,n;
    cin >> q >> h >> s >> d >> n;
    vector<long long int> v;
    v.push_back(n / 2 * d + (n % 2) * s);
    v.push_back(n / 2 * d + (n % 2) * 2 * h);
    v.push_back(n / 2 * d + (n % 2) * 4 * q);
    v.push_back(n * s);
    v.push_back(n * 2 * h);
    v.push_back(n * 4 * q);
    sort(v.begin(),v.end());
    cout << v[0] << "\n";

    return 0;
}

Measured memory_bytes: 256
# frozen_string_literal: true

def prime?(n)
  if n == 2
    true
  elsif n.even? || n < 2
    false
  else
    i = 3
    limit = Math.sqrt(n)
    while i <= limit
      if n % i == 0 then return false else i += 2 end
    end
    return true
  end
end

n = gets.to_i
arr = n.times.map { gets.to_i }
cnt = 0
arr.each do |i|
  cnt += 1 if prime?(i)
end

puts cnt


Measured memory_bytes: 6968
import sys

def main():
    n, m, k = map(int, input().split())
    cnt = set()
    for x in range(n+1):
        for y in range(m+1):
            tmp = x*y + (n-x)*(m-y)
            if tmp not in cnt:
                cnt.add(tmp)

    if k in cnt:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 25856
/*
AizuOnline A0101
Title
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
#include <ctype.h>
//Global data section
char s[1010];
int n;
//
main()
{
  int i,j;
  char *pos,*ken;

  scanf("%d ",&n);
  for(i=0;i<n;i++)
    {
      memset(s,0,sizeof(s));
      fgets(s,sizeof(s),stdin);
      
      ken=s;
      while(pos=strstr(s,"Hoshino"))
	{
	  pos[6]='a';
	  ken=pos+1;
	}
      
      printf("%s",s);
    }
return(0);
}

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

int main(){
    int n;
    vector<int> a;
    cin >> n;
    for(int i = 0;i < n;i++){
        int buf;
        cin >> buf;
        a.push_back(buf);
    }
    int counter = 0;
    for(int i = 0;i < n;i+= 2){
        if(a[i] % 2){
            counter ++;
        }
    }
    cout << counter;
    return 0;
}


Measured memory_bytes: 3604
def main():
  N, M = map(int, input().split())
  alist = list(map(int, input().split()))
  alist.sort(reverse=True)
  nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

  dp = [-1 for _ in range(N + 1)]
  dp[0] = 0
  for a in alist:
    n = nums[a]
    for i in range(N - n + 1):
      if dp[i] == -1:
        continue
      dp[i + n] = max(dp[i + n], dp[i] * 10 + a)

  print(dp[-1])
      

if __name__ == '__main__':
  main()

Measured memory_bytes: 16496
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  cin >> N;
  vector<i64> ans(N + 1);
  for (i64 x = 1; x * x <= N; x++)
    for (i64 y = 1; y * y <= N; y++)
      for (i64 z = 1; z * z <= N; z++)
      {
        i64 t = x * x + y * y + z * z + x * y + y * z + z * x;
        if (t <= N)
          ans[t]++;
      }
  for (i64 i = 1; i <= N; i++)
    cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static List<Tuple<int,int>>[] li;
	static bool[] b;
	static int[] h;
	static int ans=0;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		int n=s[0],m=s[0]-1;
		li=new List<Tuple<int,int>>[n+1];
		b=new bool[n+1];
		h=new int[n-1];
		for(int i=1;i<=n;i++){li[i]=new List<Tuple<int,int>>();}
		for(int i=0;i<m;i++){
			int[] e=sc.Ia;
			li[e[0]].Add(Tuple.Create(e[1],i));
			li[e[1]].Add(Tuple.Create(e[0],i));
		}
		Fu(1,0);
		Console.WriteLine("{0}",ans);
		Console.WriteLine("{0}",String.Join("\n",h));
	}
	static void Fu(int a,int g){
		b[a]=true;
		for(int i=0,j=1;i<li[a].Count;i++){
			if(!b[li[a][i].Item1]){
				if(j==g){j++;}
				h[li[a][i].Item2]=j;
				Fu(li[a][i].Item1,j);
				ans=Max(ans,j);
				j++;
			}
		}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 40032
text = input()

result = ''

for i in range(len(text)):
    code = ord(text[i])
    if ord('A') <= code <= ord('Z'):
        result += chr(code + 32)
    elif ord('a') <= code <= ord('z'):
        result += chr(code - 32)
    else:
        result += chr(code)

print(result)

Measured memory_bytes: 6720
fun main(args: Array<String>) = IO().exec {
    val n = int()
    val m = int()
    println((1900L * m + (n - m) * 100) * 1L.shl(m))
}

// region template
operator fun Int.iterator() = 0.until(this).iterator()

class IO {
    val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    val out = java.io.PrintWriter(System.out)
    fun hasNextByte(): Boolean = if (ptr < buflen) true else {
        ptr = 0
        buflen = System.`in`.read(buffer)
        buflen > 0
    }

    fun readByte(): Byte = if (hasNextByte()) buffer[ptr++] else -1
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }

    fun string(): String {
        if (!hasNext()) throw java.util.NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun long(): Long {
        if (!hasNext()) throw java.util.NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }

    fun double(): Double = string().toDouble()
    fun print(obj: Any) = out.print(obj)
    fun print(i: Int) = out.print(i)
    fun print(l: Long) = out.print(l)
    fun println(obj: Any) = out.println(obj)
    fun println(i: Int) = out.println(i)
    fun println(l: Long) = out.println(l)
    inline fun exec(block: IO.() -> Unit) {
        block()
        out.flush()
    }
}
// endregion

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

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

  cout << "ABC" << n << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

istream& operator>> (istream& a, pii& b) {
    cin >> b.first >> b.second;
    return a;
}

ostream& operator<< (ostream& a, const pii& b) {
    cout << "{" << b.first << ", " << b.second << "}";
    return a;
}

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e5;
    // const int mod = 2600000069;
    // const int p = 10;
    // const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
    // const ld PI = 3.1415926535;
#endif

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")  
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

const int MAXN = 2e6 + 100;
const int mod = 1e9 + 7;

int f[MAXN];

int powmod(int a, int p) {
    if (p == 0) return 1;
    if (p == 1) return a % mod;
    int k = powmod(a, p >> 1);
    if (p & 1) return (k * k % mod) * a % mod;
    return k * k % mod;
}

int rev(int a) {
    return powmod(a, mod - 2);
}

int C(int n, int k) {
    int ans = f[n];
    ans = (ans * rev(f[n - k])) % mod;
    ans = (ans * rev(f[k])) % mod;
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    f[0] = 1;
    for (int i = 1; i < MAXN; i++) {
        f[i] = (f[i - 1] * i) % mod;
    }
    int k;
    cin >> k;
    string s;
    cin >> s;
    int m = s.size();
    int n = m + k;
    int ans = 0;
    for (int i = m; i <= n; i++) {
        int cur = C(i - 1, m - 1);
        cur = (cur * powmod(25, i - m)) % mod;
        cur = (cur * powmod(26, n - i)) % mod;
        ans = (ans + cur) % mod;
    }
    cout << ans;
}
/*

*/

Measured memory_bytes: 19944
use std::io::*;
use std::str::FromStr;

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();
    let ans = c - (a - b);
    println!("{}", if ans >= 0 {ans} else {0});
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
def main():
  import sys
  a=int(input())
  b=tuple(map(int,sys.stdin.readline().split()))
  c=[[i,b[i-1]] for i in range(1,a+1)]
  d=sorted(c,key=lambda x:x[1])
  e=[i[0] for i in d]
  print(" ".join(map(str,e)))
if __name__=="__main__":
  main()

Measured memory_bytes: 28928
#include<bits/stdc++.h>
using namespace std;
int main(){
  int ans=0;
  string s; cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i]=='+') ans++;
    else if(s[i]=='-') ans--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    string s;
    cin >> s;
    int N = 4;

    string op;

    REP(bit, (1<<N-1)){
        int sum = s[0] - '0';
        char c;
        c = s[0];
        op = c;
        REP(i, N-1){
            if (bit & 1<<i) {
                sum += s[i+1] - '0';
                op = op+'+'+s[i+1];
            }

            else {
                sum -= s[i+1] - '0';
                op = op+'-'+s[i+1];
            }
                
        }
        if (sum == 7 ){
            cout << op << "=7" << endl;
          break;

        }
    }
   return 0;
}

Measured memory_bytes: 256
N = int(input())

c = [0, 0, 0, 0]

for query in range(N):
    s = input()
    if s == "AC":
        c[0] += 1
    elif s == "WA":
        c[1] += 1
    elif s == "TLE":
        c[2] += 1
    elif s == "RE":
        c[3] += 1

print("AC x " + str(c[0]))
print("WA x " + str(c[1]))
print("TLE x " + str(c[2]))
print("RE x " + str(c[3]))

Measured memory_bytes: 9156
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int a, b;
	cin >> a >> b;
	cout << max(a, b) + max(max(a, b)-1, min(a, b)) << endl;
 	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a, b, c,x;
	cin >> a >> b >> c >> x;
	int count = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (500 * i + 100 * j + 50 * k == x) {
					count++;
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}

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

int main(int argc, const char * argv[]) {
    
    int map[2][110];
    int n;
    int saidai=0;
    int sum=0;
    int counter=0;
    
    cin >> n;
    for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            cin >> map[i][j];
        }
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j<counter){
                sum+=map[0][j];
            }
            else if(j==counter){
                sum+=map[0][j];
                sum+=map[1][j];
            }
            else{
                sum+=map[1][j];
            }
        }
        
        saidai=max(saidai,sum);
        sum=0;
        counter++;
        
    }
    
    cout << saidai << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
def prod(li, MOD):
    ret = 1
    for a in li:
        ret *= a
        ret %= MOD
    return ret

N, K = map(int, input().split())
MOD = 1_000_000_007
aaa = list(map(int, input().split()))
if N == K:
    print(prod(aaa, MOD))
    exit()
aaa.sort(key=lambda x : abs(x))
if sum(a < 0 for a in aaa[-K:]) % 2 == 0:
    print(prod(aaa[-K:], MOD))
else:
    if all(a <= 0 for a in aaa):
        bbb = aaa[:K]
    else:
        try:
            x1, y1 = min([a for a in aaa[-K:] if a > 0]), min([a for a in aaa[:-K] if a < 0])
        except:
            x1, y1 = 1, 0
        try:
            x2, y2 = max([a for a in aaa[-K:] if a < 0]), max([a for a in aaa[:-K] if a >= 0])
        except:
            x2, y2 = 1, 0
        bbb = aaa[-K:]
        if abs(x2 * y1) > abs(x1 * y2):
            bbb.remove(x1)
            bbb.append(y1)
        else:
            bbb.remove(x2)
            bbb.append(y2)
    print(prod(bbb, MOD))


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }

#define F 1
#define S 2

vector<lli> G[100100];
lli num[100100];

void func(long long N, std::vector<long long> a, std::vector<long long> b){

    REP(i,0,100100)num[i] = -1;

    queue<pair<lli,lli>> fq,sq;

    fq.push({0,0});
    sq.push({N-1,0});
    num[0] = F;
    num[N-1]=S;

    lli cntF=0,cntS=0;
    while(fq.size() || sq.size()){
        if(fq.size()){
            lli topD = fq.front().second;
            while(fq.size()){
                lli topNum = fq.front().first;
                lli dd = fq.front().second;
                if(topD!= dd)break;
                fq.pop();
                cntF++;
                for(auto e:G[topNum]){
                    if(num[e]!=-1)continue;
                    num[e]=F;
                    fq.push({e,dd+1});
                }
            }
        }

        if(sq.size()){
            lli topD = sq.front().second;
            while(sq.size()){
                lli topNum = sq.front().first;
                lli dd = sq.front().second;
                if(topD!= dd)break;
                sq.pop();
                cntS++;
                for(auto e:G[topNum]){
                    if(num[e]!=-1)continue;
                    num[e]=S;
                    sq.push({e,dd+1});
                }
            }
        }
    }
    if(cntF>cntS)cout<<"Fennec"<<endl;
    else cout<<"Snuke"<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        a[i]--,b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    func(N, std::move(a), std::move(b));
    return 0;
}


Measured memory_bytes: 8960
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif
const ll MOD = (ll)(1e9 + 7);
map <pll, ll> dp;
ll func(ll s, ll x) {
    if((s == 0 && x == 0) || (s == 1 && x == 0) 
        || (s == 0 && x == 1)) return 1;

    if(dp.count(pll(s, x)) == 1) return dp[pll(s, x)];

    ll ans = func(s/2, x/2) % MOD;

    if(s >= 1 && x >= 1) ans += func((s-1)/2, (x-1)/2) % MOD;
    
    if(s >= 2) ans += func((s-2)/2, x/2) % MOD;

    return dp[pll(s, x)] = ans % MOD;
}

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

    ll N; cin >> N;

    ll ans = func(N, N);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*
 root (x1-x2)^2 + (y1-y2)^2 = ((x1-x2) + (y1-y2))^2 - 2*(x1-x2)*(y1-y2)

 (x1-x2)*(y1-y2) = 0
 x1 = x2  
 or
 y1 = y2

 a = (x1 == x2)

 b = (y1 == y2)

 c = (x1==x2 && y1 == y2)

 c = c*(c-1)/2;


 a * b - c;
*/

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

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

    int a[n][3];
     int dp[n][3];
    for(int i =0;i<n;i++){
    	cin>>a[i][0]>>a[i][1]>>a[i][2];

    	if(i==0){
    		dp[i][0]=a[i][0];dp[i][1]=a[i][1];dp[i][2]=a[i][2];
    	}
    	else{
    	dp[i][0]=INT_MAX;dp[i][1]=INT_MAX;dp[i][2]=INT_MAX;
    	}	
    }
   
    for(int i =1;i<n;i++)
    {
    	dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i][0];
    	dp[i][1] = max(dp[i-1][0],dp[i-1][2])+a[i][1];
    	dp[i][2] = max(dp[i-1][1],dp[i-1][0])+a[i][2];
    }


  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
}



Measured memory_bytes: 2560
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from math import gcd
def resolve():
    x = int(input())
    g = gcd(x, 360)
    print(360 // g)
resolve()

Measured memory_bytes: 62160
#include<bits/stdc++.h>
using namespace std;
int a[10000];
int main() {
    int n;
    cin>>n;
    long long sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    cout<<a[0]<<" "<<a[n-1]<<" "<<sum<<endl;
}



Measured memory_bytes: 3156
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int i=0,x=1;
    int A[] = new int[999999];

    while(x!=0){
      x = scanner.nextInt();
      A[i] = x;
      i++;
    }
    for(int j=1; j<i; j++){
      System.out.println("Case " + j + ": " + A[j-1]);
    }
  }
}



Measured memory_bytes: 47324
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long double A, B, H, M;
  cin >> A >> B >> H >> M;
  const long double PI = acos(-1);
  long double ans
      = sqrt(A * A + B * B
             - 2 * A * B * cos(2 * PI * (H / 12 + M / 12 / 60 - M / 60)));
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}


Measured memory_bytes: 4100