akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 1e5 + 5;
const ll LINF = 1e18 + 5;
int n, q;
int ans[N];
int bit[2][N];
int fa[N][25], dep[N], dis[N];
int in[N], out[N], id;
struct node
{
	int to, c, w;
};
vector <node> G[N];
vector <tuple<int, int, int>> col[N];
struct Query
{
	int x, y, u, v, id;
	bool operator < (const Query& a) { return x < a.x; } 
}ask[N];
inline void addedge(int a, int b, int c, int d)
{
	G[a].push_back({b, c, d});
	G[b].push_back({a, c, d});
}
void modify(int x, int v, int type)
{
	for(int i=x; i<=n; i+=(i&-i)) bit[type][i] += v;
}
void update(int x, int y, int v, int type)
{
	modify(x, v, type);
	modify(y+1, -v, type);
}
int query(int x, int type)
{
	int res = 0;
	for(int i=x; i>0; i-=(i&-i)) res += bit[type][i];
	return res;
}
void dfs(int u) 
{	
	for(int i=1;i<=20;i++) fa[u][i] = fa[fa[u][i-1]][i-1];
	in[u] = ++id;
	for(auto it : G[u])
	{
		int v = it.to, w = it.w;
		if(v!=fa[u][0])
		{
			dis[v] = dis[u] + w;
			dep[v] = dep[u] + 1;
			fa[v][0] = u; 
			dfs(v);
 		}
	}
	out[u] = id;
}
int LCA(int x,int y) 
{
	if(dep[x]>dep[y]) swap(x,y);
	for(int i=20;i>=0;i--)
		if(dep[fa[y][i]]>=dep[x]) y = fa[y][i]; 
	if(x==y) return x;
	for(int i=20;i>=0;i--)
		if(fa[x][i]!=fa[y][i]) x = fa[x][i], y = fa[y][i]; 
	return fa[x][0];
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> q;
 	for(int i=1; i<n; i++)
 	{
 		int a, b, c, d;
 		cin >> a >> b >> c >> d;
 		addedge(a, b, c, d);
 		col[c].emplace_back(a, b, d);
 	}
 	for(int i=1; i<=q; i++)
 	{
 		cin >> ask[i].x >> ask[i].y >> ask[i].u >> ask[i].v;
 		ask[i].id = i;
 	}
 	dep[1] = 1;
 	dfs(1);
 	sort(ask+1, ask+q+1);
 	int cur = 1;
 	for(int i=1; i<n; i++)
 	{
 		for(auto j : col[i])
 		{
 			int x, y, z;
 			tie(x, y, z) = j;
 			if(dep[x]<dep[y]) swap(x, y);
 			update(in[x], out[x], 1, 0);
 			update(in[x], out[x], z, 1);
 		}
 		while(cur<=q && ask[cur].x==i)
 		{
 			int u = ask[cur].u, v = ask[cur].v, lca = LCA(u, v);
			int res = dis[u] + dis[v] - 2*dis[lca];
			int a = query(in[u], 0) + query(in[v], 0) - 2*query(in[lca], 0);
			int b = query(in[u], 1) + query(in[v], 1) - 2*query(in[lca], 1);
//			debug(a); debug(b);
			ans[ask[cur].id] = res - b + a*ask[cur].y;	
 			cur++;
 		}
 		for(auto j : col[i])
 		{
 			int x, y, z;
 			tie(x, y, z) = j;
 			if(dep[x]<dep[y]) swap(x, y);
 			update(in[x], out[x], -1, 0);
 			update(in[x], out[x], -z, 1);
 		}
 	}
 	for(int i=1; i<=q; i++) cout << ans[i] << '\n';
	return 0;
}


Measured memory_bytes: 28600
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;

ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll get_val(vector<ll>&ft,ll index)
{
  ll res=0;
  for(;index>=0;index=(index & (index+1))-1)
    res+=ft[index];
  return res;
}

void update(vector<ll>&ft,ll index,ll val)
{
  for(;index<(ll)ft.size();index|=index+1)
    ft[index]+=val;
}

ll max_sum(vector<ll>&a)
{
  ll n=a.size();
  ll i,cur=0,res=0;
  for(i=0;i<n;i++)
  {
    if(a[i]>=0)
    {
      if(cur>=0) cur+=a[i];
      else cur=a[i];
    } 
    else
    {
      if(cur>=0) cur+=a[i];
      else cur=a[i];
    }
    res=max(res,cur);
  }
  return res;
}

string ans;
ll n,k,upr;

void func(string &cur,ll rem,bool flag,ll minl)
{
  if(rem==0) {ans=min(ans,cur); return;}
  if(ans.length()>0 && cur.length()==ans.length()) return;
  if(cur.length()>=upr) return;
  if(flag)
  {
    for(ll i=0;i<=9;i++)
    {
      ll next=(i+1)%10;
      ll cnt=minl+1;
      if(i*(k+1-cnt) + next*cnt >rem) break;
      cur=to_string(i)+cur;
      bool fg=false;
      if(next==0) fg=true;

      ll val=min(i,next);
      func(cur,rem- (i*(k+1-cnt) + next*cnt),fg,val);
      cur=cur.substr(1,cur.length()-1);
    }
  }
  else
  {
    for(ll i=0;i<=9;i++)
    {
      if((k+1)*i>rem) break;
      cur=to_string(i)+cur;
      func(cur,rem-(k+1)*i,false,-1);
      cur=cur.substr(1,cur.length()-1);
    }
  }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //   #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    
    // Sieve();
   ll tests=1;
 // cin>>tests;
  // ll t=1;
    while(tests--)
    {  
      ll a;
      cin>>a;
      cout<<a+(a*a)+(a*a*a);


    }

    return 0;
   }

Measured memory_bytes: 14152
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

typedef int64_t ll;

constexpr int dx[4] = { 1, 0, -1, 0 };
constexpr int dy[4] = { 0, 1, 0, -1 };

#define SPRE(x) setprecision(x) // 精度を指定

int main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    vector<string> s;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string tmp;
        cin >> tmp;
        s.push_back(tmp);
    }
    vector<int> alpha(26);
    for(auto t : s[0]) {
        int tmp = t - 'a';
        alpha[tmp]++;
    }
    for (int i = 1; i < s.size(); i++) {
        vector<int> al(26);
        for(auto t : s[i]) {
            int tmp = t - 'a';
            al[tmp]++;
        }
        for (int i = 0; i < al.size(); i++) {
            alpha[i] = min(alpha[i], al[i]);
        }
    }

    for(char c = 'a'; c <= 'z'; c++)
    {
        int t = alpha[c-'a'];
        for(int i = 0; i < t; i++)
            cout << c;
    }
    cout << endl;
}



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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    string o,e;
    cin >> o >> e;
    ll size1,size2,size;
    size1 = o.size();
    size2 = e.size();
    size = min(size1,size2);
    rep(i,size) cout << o[i] << e[i];
    if(size1 > size2) cout << o[size1-1];
    if(size1 < size2) cout << e[size2-1];
    cout << "\n";
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll mod = 998244353;
const int N = 3005;
int a[N];
ll dp[N][N], sdp[N][N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, s;
	cin>>n>>s;
	for(int i = 1; i <= n; i++){
		cin>>a[i];
	}
	memset(dp, 0, sizeof(dp));
	memset(sdp, 0, sizeof(sdp));
	for(int i = 1; i <= n; i++){
		dp[i][a[i]] = i;
		for(int sum = a[i] + 1; sum <= s; sum++){
			dp[i][sum] = sdp[i - 1][sum - a[i]];
		}
		for(int sum = 0; sum <= s; sum++){
			sdp[i][sum] = sdp[i - 1][sum] + dp[i][sum];
			if(sdp[i][sum] >= mod)sdp[i][sum] -= mod;
		}
	}
	// for(int i = 1; i <= n; i++){
	// 	for(int sum = 0; sum <= s; sum++){
	// 		cout<<dp[i][sum]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		ans += (n - i + 1)*dp[i][s];
		ans %= mod;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 141312
# include <iostream>
# include <stdint.h>
# include <stdio.h>
# include <math.h>
# include <algorithm>
# include <string>
using namespace std;


int main(){
	string str ,order,p;
    int q ,a, b;
    char x;
    cin >>str >>q;
    for(int i =0;i<q;i++){
        cin >>order >>a >>b;
        if(order == "print"){
            cout << str.substr(a,b-a+1) <<"\n";
        }
        else if(order == "reverse"){
            
                reverse(str.begin() +a,str.begin() + b+1);
        }
        else if(order =="replace"){
            cin >>p;
           str.replace(str.begin() +a,str.begin() +b+1,p);
        }
    }

	return 0;
}



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

int main()
{
    data_type n,w,m=INT_MIN;
    cin>>n>>w;
    vector<pair<data_type,data_type>>vc(n);
    for(auto &i:vc)
        cin>>i.first>>i.second;
    vector<vector<data_type> > dp(n+1,vector<data_type>(100001,INT_MAX));
    dp[0][0]=0;
    for(int i=1; i<=n; i++)
        {
            for(int j=0; j<=100000; j++)
                {
                    if(j==0)
                        {
                            dp[i][j]=0;
                            continue;
                        }

                    if(j<vc[i-1].second)
                        {
                            dp[i][j]=dp[i-1][j];
                            continue;
                        }
                    dp[i][j]=min(dp[i-1][j-vc[i-1].second]+vc[i-1].first,dp[i-1][j]);
                }
        }

    for(data_type j=0; j<=100000; j++)
        if(dp[n][j]<=w)
            m=max(m,j);
    cout<<m<<endl;


    return 0;
}


Measured memory_bytes: 83188
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int A, B;
  scanf("%d %d", &A, &B);
  if (A + B >= A - B && A + B >= A * B)
    printf("%d", A + B);
  else if (A - B >= A + B && A - B >= A * B)
    printf("%d", A - B);
  else if (A * B >= A + B && A * B >= A - B)
    printf("%d", A * B);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
	int a[3][3][2] = {0};
	for(int i = 0; i < 3; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			scanf("%d", &a[i][j][0]);
		}
	}
	int n;
	scanf("%d", &n);
	for(int k = 0; k < n; k++)
	{
		int x, found = 0; scanf("%d", &x);
		for(int i = 0; i < 3; i++)
		{
			for(int j = 0; j < 3; j++)
			{
				if(x == a[i][j][0])
				{
					a[i][j][1] = 1;
					found = 1;
					break;
				}
			}
			if (found) break;
		}
	}
	int yes = 0, rcount[3] = {0}, ccount[3] = {0}, d1 = 0, d2 = 0;
	for(int i = 0; i < 3; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			if(a[i][j][1] == 1) 
			{
				rcount[i]++;
				ccount[j]++;
			}
			if(i == j && a[i][j][1] == 1) d1++;
			if (i + j == 2 && a[i][j][1] == 1) d2++;
		}
	}
	for(int i = 0; i < 3; i++)
	{
		if(rcount[i] == 3 || ccount[i] == 3)
		{
			yes = 1;
			break;
		}
	}
//	printf("%d %d %d\n", yes, d1, d2);
	(yes || d1 == 3 || d2 == 3)? puts("Yes\n") : puts("No\n");
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF INT_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[20];
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n)cin>>x[i];
	f(i,n-2){
		if((x[i+1]>x[i]&&x[i+1]<x[i+2])||(x[i]>x[i+1]&&x[i+1]>x[i+2]))ans++;
	}
	cout<<ans<<endl;
}


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

using namespace std;

int main() {
    vector<int> v;
    int tmp;
    while(cin >> tmp) {
        v.push_back(tmp);
    }   
    int k = v.back();
    v.pop_back();

    sort(v.begin(), v.end());
    int dist = v.back() - v.front();
    if(dist > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Solve is
   N : Integer;
   A : Integer;
   Count : Integer;
begin
   Get (N);
   Count := 0;
   for I in 1 .. 4 loop
      A := N-N/10*10;
      if A = 2 then
         Count := Count+1;
      end if;
      N := N/10;
   end loop;
   Put_Line (Integer'Image (Count));
end Solve;

Measured memory_bytes: 3676
import java.util.*;

class Main{
  static Scanner sc = new Scanner(System.in);
  public static void main(String args[]){
    String s=sc.next();
    String t=sc.next();
    final int wakeru = 2000;
    String[] ss = new String[(s.length()+wakeru-1)/wakeru];
    for(int i=0;i<ss.length;i++){
      ss[i]=s.substring(wakeru*i,Integer.min(wakeru*(i+1),s.length()));
    }
    boolean[][] exist = new boolean['z'-'a'+1][ss.length];
    for(int i='a';i<='z';i++){
      for(int j=0;j<ss.length;j++){
        exist[i-'a'][j]=(ss[j].indexOf(i)!=-1);
      }
    }
//    System.out.println(Arrays.deepToString(exist));
    long page=0;
    int sect=0;
    int gaze=-1;
    
    for(int i=0;i<t.length();i++){
      int will=-1;
      if(exist[t.charAt(i)-'a'][sect]){
        will=ss[sect].indexOf(t.charAt(i),gaze+1);
      }
      if(will==-1){
        for(int j=sect+1;j<ss.length;j++){
          if(exist[t.charAt(i)-'a'][j]){
            sect=j;
            will=ss[sect].indexOf(t.charAt(i));
            break;
          }
        }
      }
      if(will==-1){
        for(int j=0;j<=sect;j++){
          if(exist[t.charAt(i)-'a'][j]){
            page++;
            sect=j;
            will=ss[sect].indexOf(t.charAt(i));
            break;
          }
        }
        if(will==-1){
          System.out.println(-1);
          return;
        }
      }
      gaze=will;
    }
    System.out.println(page*s.length()+((long)sect*wakeru)+gaze+1);
    
    
  }
}

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

int main()
{
    int a,b,d;
    cin>>a>>b;
    d=(a+b)/2;
    if((a+b)%2==0)
    {
        cout<<d<<endl;
    }
    else
    {
        cout<<"IMPOSSIBLE\n";
    }
    return 0;
}


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

namespace ABC099
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> list = new List<string>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == null) break;
                list.Add(line);
            }

            int a = int.Parse(list[0].ToString());
            var str = list[0].ToCharArray();


            List<int> result = new List<int>();
            foreach (var item in str)
            {
                result.Add(int.Parse(item.ToString()));
            }
            int sum = result.Sum();

            if (a % sum == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7



int main() {
	char S[5], T[5];
	scanf("%s", S);
	scanf("%s", T);

	int ans = 0;

	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i]) {
			ans++;
		}
	}
	printf("%d", ans);

	return 0;

}






Measured memory_bytes: 128
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List
import Data.Array.IO
import Control.Monad

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  edge <- (\[x,y,z] -> zip3 x y z) . transpose <$> getInt2DListBC
  graph <- newArray ((0, 1), (n, n)) (10^9) :: IO Memo2D
  foldM initWF graph edge
  foldM initWF graph [(i, i, 0) | i <- [1..n]]
  let index = [(k, i, j) | k <- [1..n], i <- [1..n], j <- [1..n]]
  foldM warshallFloyd graph index
  writeArray graph (0, 1) 0
  foldM (count n) graph edge
  ans <- readArray graph (0, 1)
  print ans

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getInt2DListBC :: IO [[Int]]
getInt2DListBC = map (map bsToInt . BC.words) . BC.lines <$> BC.getContents

type Memo2D = IOUArray (Int, Int) Int
type Road = IOUArray (Int, Int) Bool

initWF :: Memo2D -> (Int, Int, Int) -> IO Memo2D
initWF memo (x, y, d) = do
  writeArray memo (x, y) d
  writeArray memo (y, x) d
  return memo

warshallFloyd :: Memo2D -> (Int, Int, Int) -> IO Memo2D
warshallFloyd memo (k, i, j) = do
  x <- readArray memo (i, j)
  y <- readArray memo (i, k)
  z <- readArray memo (k, j)
  let minWeight = min x $ y + z
  writeArray memo (i, j) minWeight
  return memo

count :: Int -> Memo2D -> (Int, Int, Int) -> IO Memo2D
count n memo e = do
  c <- readArray memo (0, 1)
  b <- foldM (warshallFloyd' e memo) False [1..n]
  let c' = if b then c else c + 1
  writeArray memo (0, 1) c'
  return memo

--graph(0,1) : count
warshallFloyd' :: (Int, Int, Int) -> Memo2D -> Bool -> Int -> IO Bool
warshallFloyd' (i, j, w) memo b s = do
  x <- readArray memo (s, i)
  y <- readArray memo (s, j)
  return $ b || x + w == y


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

using namespace std;

int main() {
	string s; cin >> s;
	int sz = s.size();
	long long k; cin >> k;
	long long ans = 0;
	if (sz == 1) {
		cout << k / 2 << endl;
	} else {
		int cnt = 0, cntf = 1, cntb = 1;
		int i = 1;
		while (i < sz && s[i] == s[i - 1]) cntf++, i++;
		i = sz - 1;
		while (i > 0 && s[i] == s[i - 1]) cntb++, i--;
		for (i = 1; i < sz; ++i)
			if (s[i] == s[i - 1]) s[i] = '@', cnt++, i++;
		if (s[0] != s[sz - 1]) {
			ans = cnt * k;
		} else if (cntf == 1 && cntb == 1) { // a???...???a
			ans = (cnt + 1) * k - 1;
		} else if (cntf == sz) { // aaaa...a
			if (cntf & 1) ans = (cntf + cntb) / 2 * (k / 2) + (k & 1 ? cnt : 0);
			else ans = cnt * k;
		} else { // a...a??...??a...a
			if ((cntf & 1) && (cntb & 1)) ans = cnt + (cnt + 1) * (k - 1);
			else ans = cnt * k;
		}
		cout << ans << endl;
	}
	
	return 0;
}

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

    }
    return 0;
}


Measured memory_bytes: 2032
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

int n,m;

void solve(istream& cin, ostream& cout) {
	int a,b,c;
	cin >>a>>b>>c;
	cout << c  << " " << a <<" " << b<< endl;
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


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

#define    int               long long int
 #define    bp(x)         __builtin_popcount(x)
#define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
#define  mod   998244353
#define  endl  "\n"
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int a[200005];
int32_t main()
{
    fast
    a[1]=1;
    int n,k,x,y;    cin>>n>>k;
    vector<pii>v;
    f(i,1,k){
        cin>>x>>y;
        v.pb({x,y});
    }
    f(i,2,n){
        int temp=0;
        f(j,0,k-1)
        {  
            x=max(0LL,i-v[j].ff);
            y=max(0LL,i-v[j].ss-1);
            temp=(temp+ a[x] -a[y] + mod)%mod;
        }
        a[i]=(temp+a[i-1])%mod;
    }
    cout<<(a[n]-a[n-1] + mod + mod)%mod;
}

Measured memory_bytes: 5208
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  int sum = 0;
  for (int i = 0; i < N; i++) {
    int s = S[i] - '0';
    sum += s;
  }
  if (sum % 9 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
using namespace std;

int main(){
    int n,d,x;
    cin >> n >> d >> x;

    int cnt = 0;
    for ( int i = 0 ; i < n ; i++){
        int a;
        cin >> a;
        int j = 1;
        while( j <= d ){
            cnt++;
            j += a;
        }
    }
    int ans = cnt + x;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath> // abs関数に利用
#include<algorithm> // sort
using namespace std;
// 
// problem https://atcoder.jp/contests/abc125/tasks/abc125_d
// reference http://drken1215.hatenablog.com/entry/2019/04/27/224100
// Algorithm Point:初期の並びを見て負の数が偶数個→並べ替え方の工夫で全部負の数を正の数にできるので絶対値ですべて足す
//                                       奇数個→どうやっても負の数が一つ出来る→絶対値最小のものを負の数、それ以外を絶対値で足す

long long solver(int allNumber,vector<long long> numbers){
    vector<long long> b(allNumber);
    int checkMinus=0;
    for(int j=0;j<allNumber;j++){
        if(numbers.at(j)<0)checkMinus=checkMinus+1;
    }

    bool minusEven=true;
    if(checkMinus%2==1)minusEven=false;
//    cout << "minusEven=" << minusEven << endl;

    for(int j=0;j<allNumber;j++){
        b.at(j)=abs(numbers.at(j));
    }
    sort(b.begin(),b.end());
/**    for (int i = 0; i < allNumber; i++)
    {
        cout << b.at(i) << ",";
    }
    cout << endl;**/
    long long allSum=0;
    for(int j=0;j<allNumber;j++){
        allSum = allSum+b.at(j);
    }
    if(minusEven){
        return allSum;
    }
    else{
        return allSum-b.at(0)*2;// 足しすぎた値(最小値)は残ったマイナスとして処理
    }
    return allSum;
}

int main(void){
    int N;
    long long answer;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    answer = solver(N,A);
    cout << answer << endl;

}


Measured memory_bytes: 2560
l = int(input())
ll = l
n = 0
while ll > 0:
    ll >>= 1
    n += 1
es = []
for i in range(n-1):
    es.append((i+1, i, 0))
    es.append((i+1, i, 1<<i))

ll = l
for i in range(n-1):
    if (ll>>i)&1 != 0:
        ll &= ll-1
        es.append((n-1, i, ll))

m = len(es)
print(n, m)
for e in es:
    print(n-e[0], n-e[1], e[2])


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 5) cout << 0 << endl;
  else if (a <= 12) cout << b / 2;
  else cout << b << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    long long sum=0;
    int x=10;
    int y=25;
    cin>>x>>y;
    if(x==1)
        sum+=300000;
    if(x==2)
        sum+=200000;
    if(x==3)
        sum+=100000;
    if(y==1)
        sum+=300000;
    if(y==2)
        sum+=200000;
    if(y==3)
        sum+=100000;
    if(x==1 && y==1)    sum+=400000;
    cout<<sum;
    
}

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

#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define forup(i,l,r) for (register int i = l ; i <= r ; i += lowbit(i))
#define fordown(i,id) for (register int i = id ; i ; i -= lowbit(i))
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define lowbit(x) (x&(-x))

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pr;

const ll MAX = 2e18;
const ld inf = 2e18;
const int N = 3e6 + 10;
const int maxn = 200020;
const ll mod = 1e9 + 7;

inline ll power(ll x,ll y){
	y = ((y % (mod - 1)) + (mod - 1)) % (mod - 1);
//	if ( y < 0 ) return power(power(x,-y),mod - 2);
	ll res = 1;
	while ( y ){
		if ( y & 1 ) res = res * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}

int len,s[maxn],fail[maxn];
int trans[maxn][10];
void getfail(){
	fail[1] = 0;
	int p = 0;
	rep(i,2,len){
		while ( p && s[i] != s[p + 1] ) p = fail[p];
		if ( s[i] == s[p + 1] ) fail[i] = ++p;
		else fail[i] = 0;
	}
}
struct node{
	ll len,cnt[50];
	node() { len = 0 , memset(cnt,0,sizeof(cnt)); }
	node operator + (node a){
		node cur;
		rep(i,0,25) cur.cnt[i] = a.cnt[i] + cnt[i];
		cur.len = len + a.len;
		if ( cur.len > MAX ) cur.len = MAX;
		return cur;
	}
}g[100];
char ch[maxn];
ll l,r;

void init(){
	len /= 2;
	rep(i,1,len) s[i] = ch[i] - 'a';
	getfail();
	g[0].len = len;
	rep(i,1,len) g[0].cnt[s[i]]++;
	g[1] = g[0];
	g[1].len += len - fail[len];
	rep(i,1,len - fail[len]) g[1].cnt[s[i]]++;
	rep(i,2,100){
		g[i] = g[i - 1] + g[i - 2];	
	}
}
node calc(ll n){
	node res;
	if ( !n ) return res;
	repd(i,100,0){
		if ( n >= g[i].len ) res = res + g[i] , n -= g[i].len; //发现这个地方特别好写，因为g[n] = g[n- 1] + g[n - 2],无论n是否大于当前长度，都考虑第n-1项
	}
	rep(i,1,n) res.cnt[s[i]]++;
	return res;
}
int main(){
	scanf("%s",ch + 1);
	cin>>l>>r;
	len = strlen(ch + 1);
	init();
	node ans1 = calc(r),ans2 = calc(l - 1);
	rep(i,0,25) cout<<ans1.cnt[i] - ans2.cnt[i]<<" ";
	cout<<endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h, w; cin >> h >> w;
    vector<string> m(h); cin >> m;
    vector<vector<ll>> pos(w-1);
    rep(x, w-1) {
        pos[x].pb(0);
        vector<ll> f(h);
        rep(y, h) {
            f[y] = m[y][x] == m[y][x+1];
        }
        rep(y, 1, h) {
            if (f[y] != f[y-1]) {
                pos[x].pb(y);
            }
        }
        pos[x].pb(h);
    }
    vector<vector<ll>> posr(h+1);
    rep(i, w-1) each(j, pos[i]) {
        posr[j].pb(i);
    }
    ll ans = h;
    rep(x, w) {
        vector<vector<ll>> ev(w);
        rep(y, 1, h) {
            auto it = lower_bound(all(posr[y]), x);
            if (it == posr[y].end()) continue;
            ev[*it].pb(y);
        }
        // cout << x << endl;
        // cout << ev << endl;
        priority_queue<P> Q;
        Q.push({h, 0});
        set<ll> s;
        s.insert(0);
        s.insert(h);
        rep(xx, x, w-1) {
            each(y, ev[xx]) {
                // cout << "insert " << y << endl;
                s.insert(y);
                auto it = s.find(y);
                auto itp = it, itn = it;
                --itp; ++itn;
                Q.push({*it - *itp, *itp});
                Q.push({*itn - *it, *it});
            }
            while (1) {
                assert( !Q.empty() );
                P p = Q.top();
                auto it = s.find(p.second);
                assert(it != s.end());
                ++it;
                assert(it != s.end());
                if (*it - p.second == p.first) {
                    // cout << (xx+2-x)*p.first << " : " << x << " " << xx << " " << *it-1 << " " << p.second << endl;
                    chmax(ans, (xx+2-x)*p.first);
                    break;
                }
                else {
                    Q.pop();
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 57648
N = int(input())
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
    if A[0] != 0:
        print(0)
        exit()
    for i in range(N // 2):
        if A[2 * i + 1] != 2 * (i + 1) or A[2 * i + 2] != 2 * (i + 1):
            print(0)
            exit()
    print(pow(2, N // 2) % (10 ** 9 + 7))
else:
    for i in range(N // 2):
        if A[2 * i] != 2 * i + 1 or A[2 * i + 1] != 2 * i + 1:
            print(0)
            exit()
    print((pow(2, N // 2)) % (10 ** 9 + 7))


Measured memory_bytes: 14008
S = list(input())
N = len(S)

ans = 0
for i in range(2**(N-1)):
    siki = S[0]
    for j in range(N-1):
        if i>>j&1:
            siki += '+'
        siki += S[j+1]
    ans += eval(siki)
print(ans)


Measured memory_bytes: 2940
#define T 999
D[T][T],i,j,x,y,a,b,c,R,F=9999;main(k){scanf("%*d%d%d",&x,&y);for(D[0][0]=F;~scanf("%d%d%d",&a,&b,&c);)for(i=T;i-->a;)for(j=T;j-->b;)k=D[i-a][j-b]-c,D[i][j]<k?D[i][j]=k:0;for(i=x,j=y;i<T&&j<T;i+=x,j+=y)D[i][j]>R?R=D[i][j]:0;printf("%d\n",R>0?F-R:-1);}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,a,b,p,q,s[50],g;
vector<ll> v[2];

void dfs(int f,ll pos,ll ss,ll e){
  if(pos==e){
    v[f].push_back(ss);
    return;
  }
  ll ns=s[pos]+ss;
  dfs(f,pos+1,ss,e);
  dfs(f,pos+1,ns,e);
}

int main(){
  cin>>n>>m>>a>>b>>p>>q;
  if(b==1&&a==1){
    if(m/(p+q)>=n)cout<<m-(p+q)*n<<endl;
    else cout<<min(p+q-(m%(p+q)),m%(p+q))<<endl;    
  }
  else{
    for(ll i=0,x=p,y=q;i<n;i++,x*=a,y*=b){
      ll ss=x+y;
      s[g++]=ss;
      if(ss>m)break;
    }
    v[0].push_back(0);
   v[1].push_back(0);
   v[1].push_back(1e16);
    dfs(0,0,0,g/2);
    dfs(1,g/2,0,g);
    ll ans=m;
    sort(v[1].begin(),v[1].end());
    for(int i=0;i<v[0].size();i++){
      int l=0,M,r=v[1].size();
      while(l<r){
	M=(l+r)/2;
	if(v[0][i]+v[1][M]<=m)l=M+1;
	else r=M;
      }
      ans=min(ans,m-v[0][i]-v[1][r-1]);
      ans=min(ans,v[0][i]+v[1][r]-m);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 43856
#include<bits/stdc++.h>
#include <bitset>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
void solve()
{
   ll a;
   cin>>a;
   cout<<a+(a*a)+(a*a*a)<<endl;
}


int main()
{
    fast;

    solve();

    }


Measured memory_bytes: 3596
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <map>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<llint, llint> P;
typedef pair<llint, P> E;

string s;
map<char, llint> mp;

llint calc(llint a, char c, llint b)
{
	if(c == '+') return a+b;
	if(c == '-') return a-b;
	if(c == '*') return a*b;
}

bool isDigit(char c)
{
	return (c >= '0' && c <= '9');
}

llint parseNumber(llint &pos)
{
	llint ret = 0;
	while(1){
		if(isDigit(s[pos])) ret *= 10, ret += s[pos] - '0';
		else break;
		pos++;
	}
	return ret;
}

llint parse(llint &pos, llint depth)
{
	if(depth == 3){
		if(s[pos] == '('){
			pos++;
			llint res = parse(pos, 0);
			pos++;
			return res;
		}
		return parseNumber(pos);
	}
	
	llint ret = parse(pos, depth+1);
	while(1){
		if(mp.count(s[pos]) && mp[s[pos]] == depth){
			char ope = s[pos];
			pos++;
			llint res = parse(pos, depth+1);
			ret = calc(ret, ope, res);
		}
		else break;
	}
	return ret;
}

int main(void)
{
	cin >> s;
	s += "#";
	
	llint ans; bool flag = false;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				mp['+'] = i, mp['-'] = j, mp['*'] = k;
				llint p = 0;
				if(!flag) ans = parse(p, 0), flag = true;
				else ans = max(ans, parse(p, 0));
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3224
#include<stdio.h>

int main(){
    int N, i;
    long long A[110000];
    long long sum=0, sumA=0;
    long long X[110000];

    scanf("%lld", &N);
    for(i=0; i<N; i++){
        scanf("%lld", &A[i]);
        sum += A[i];
        if(i%2==1){
            sumA+=A[i];
        }
    }
    X[0] = sum - sumA*2;

    for(i=1; i<N; i++){
        X[i] = 2*A[i-1]-X[i-1];
    }

    for(i=0; i<N; i++){
        printf("%lld ", X[i]);
    }

    return 0;
}

Measured memory_bytes: 2816
import itertools
N, M, Q = input().split()
N = int(N)
M = int(M)
Q = int(Q)
Num = [0 for i in range(Q)]
for i in range(Q):
  Num[i] = list(map(int,input().split()))
num = list(range(1, M+1))
A = []
for v in itertools.combinations_with_replacement(num, N):
  A.append(list(v))
score = 0
for w in A:
  scoreX = 0
  for j in range(Q):
    b = Num[j][1]
    a = Num[j][0]
    if Num[j][2] == w[b-1]-w[a-1]:
      scoreX += Num[j][3]
  if scoreX > score:
    score = scoreX
print(str(score))

Measured memory_bytes: 22976
#include <stdio.h>                                                                                                 
                                                                                                                   
int main() {                                                                                                       
    int n;                                                                                                         
    scanf("%d", &n);                                                                                               
    printf("%d\n",n%2==0?n/2-1:n/2);                                                                               
}

Measured memory_bytes: 128
# Aizu Problem ITP_1_3_B: Test Cases
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


case = 0
while True:
    x = int(input())
    if x == 0:
        break
    case += 1
    print("Case %d: %d" % (case, x))

Measured memory_bytes: 7608
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;
vector<string>v(12);
int dfs_visit(int x, int y) {
	if (x < 0 || 12 <= x || y < 0 || 12 <= y)return false;
	
	if (v[x][y] == '1') {
		v[x][y] = '0';
		dfs_visit(x - 1, y);
		dfs_visit(x + 1, y);
		dfs_visit(x, y - 1);
		dfs_visit(x, y + 1);
		return 1;
	}
	else return 0;
}

signed main() {
	while (cin >> v[0]) {
		rep(i, 1, 12)cin >> v[i];
		int cnt(0);
		rep(i, 0, 12)rep(j, 0, 12) {
			cnt += dfs_visit(i, j);
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3044
class Dice:
    def __init__(self):
        self.N = [1, 5, 2, 3, 0, 4]
        self.S = [4, 0, 2, 3, 5, 1]
        self.E = [3, 1, 0, 5, 4, 2]
        self.W = [2, 1, 5, 0, 4, 3]
    
    def roll(self, dice, dice_t, direction):
        for d in direction:
            if d == "N":
                for i in range(6):
                    dice_t[i] = dice[self.N[i]]
            elif d == "S":
                for i in range(6):
                    dice_t[i] = dice[self.S[i]]
            elif d == "E":
                for i in range(6):
                    dice_t[i] = dice[self.E[i]]
            else:
                for i in range(6):
                    dice_t[i] = dice[self.W[i]]
            for i in range(6):
                dice[i] = dice_t[i]

d = Dice()
dice = [dice for dice in input().split()]
dice_t = ["" for dice_t in range(6)]
direction = input()
d.roll(dice, dice_t, direction)
print(dice[0])

Measured memory_bytes: 7628
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		int tc = 0;
		int hc = 0;
		String check;
		while((check = sc.readLine()) != null){
			String[] temp = check.split(",");
			int a = Integer.parseInt(temp[0]);
			int b = Integer.parseInt(temp[1]);
			int c = Integer.parseInt(temp[2]);
			if(pow(a,2) + pow(b,2) == pow(c,2)){
				tc++;
			}
			if(a == b && (a + b > c || abs(a-b) < c)){
				hc++;
			}
		}
		System.out.println(tc);
		System.out.println(hc);
	}
}

Measured memory_bytes: 24108
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(input())
s, t = input().split()

ans = ''
for (sc, tc) in zip(s, t):
    ans += sc
    ans += tc

print(ans)


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

int main(){
  int n,m;
  int X,Y;

  cin >> n >> m >> X >> Y;
  
  int x[101];
  int y[101];

  for(int i=0;i < n;i++){
    cin >> x[i];
  }
  for(int i=0;i < m;i++){
    cin >> y[i];
  }

  bool flag;
  
  for(int z=-100;z <= 100;z++){
    flag = true;
    
    if(X < z && z <= Y){
      for(int i=0;i < n;i++){
	if(x[i] >= z) flag = false;
      }
      for(int i=0;i < m;i++){
	if(z > y[i]) flag = false;
      }
    }
    else flag = false;

    if(flag) break;
  }
  
  if(flag) cout << "No War" << endl;
  else cout << "War" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
int main() {
	float a,b,c,d,e,f,x,y;
	while(true){
		cin>>a>>b>>c>>d>>e>>f;
		if (cin.eof())break;
		x=c*e-b*f;
		y=a*f-c*d;
		if(x!=0){
		x/=a*e-d*b;
	}
		if(y!=0){
		y/=a*e-d*b;
	}
		printf("%.3f %.3f\n",x,y);
	}
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int N, M;

int S[2010], T[2010];

long long int dp[2100][2100];
 
int main() {
  
    cin >> N >> M;
  
    memset(dp, 0, sizeof(0));
  
    for (int i = 0; i < N; ++i) cin >> S[i],dp[i][0]=1;
  
    for (int i = 0; i < M; ++i) cin >> T[i],dp[0][i]=1;
  
  dp[N][0] = 1,dp[0][M] = 1;
  
 for(int i=1;i<=N;i++){
    for(int j=1;j<=M;j++){
     dp[i][j] = dp[i-1][j]+ dp[i][j-1] - dp[i-1][j-1];
      
        if(S[i-1] == T[j-1]){
      dp[i][j]+=dp[i-1][j-1];
        }
			dp[i][j]+=1000000007;
      
			dp[i][j]%=1000000007;
		}
	}
 
  
    cout << dp[N][M] % 1000000007 << endl;
}


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

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


Measured memory_bytes: 256
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]
    s = input().rstrip()
    if s.count('Y') >0:
        print('Four')
    else:
        print('Three')
        
if __name__ == '__main__':
    main()
 

Measured memory_bytes: 3572
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
// }}}

// misc {{{
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
// }}}

// debug(...) {{{
static bool debug_enabled = false;
static int debug_max_elms = 10;

static int debug_max_count = 50;
static int debug_current_count = 0;

void debug1(char const * x) { cout << x; }
template<class T> void debug1(const T& x) { cout << x; }
template<class T1, class T2> void debug1(const pair<T1, T2>& x) { cout << "(" << x.first << ", " << x.second << ")"; }
template<class T> void debug1(const vector<T>& x) {
  cout << "[";
  auto i = x.begin();
  while(i != x.end()) {
    debug1(*i);
	++i;
	if(i != x.end()) cout << ", ";
    if(std::distance(x.begin(), i) > debug_max_elms) {
      cout << "...";
      break;
    }
  }
  cout << "]";
}
template<class K, class V> void debug1(const map<K, V>& x) {
  cout << "{";
  auto i = x.begin();
  while(i != x.end()) {
    debug1(get<0>(*i));
    cout << ": ";
    debug1(get<1>(*i));
    ++i;
    if(i != x.end()) cout << ", ";
  }
  cout << "}";
}

void debug2() { cout << endl; }
template<class T, class... Ts> void debug2(const T& x, const Ts&... xs) {
  cout << ' ';
  debug1(x);
  debug2(xs...);
}

template<class T, class... Ts> void debug(const T& x, const Ts&... xs) {
  if(debug_enabled) {
    ++debug_current_count;
    if(debug_current_count > debug_max_count) debug_enabled = false;
	cout << "[D] ";
	debug1(x);
	debug2(xs...);
  }
}
// }}}

// main {{{
void solve();
int main() {
  auto v = getenv("DEBUG");
  if(v && string(v) == "1") debug_enabled = true;
  if(false) debug("dummy for suppress warnings", vector<int>(0));
  solve();
}
// }}}

void solve() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
  }
  double x = 0.0;
  for(auto a: A) {
    x += 1.0 / a;
  }
  cout << (1.0 / x) << endl;
}


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

#define ll long long
#define MAX 100005

ll dp[101][MAX];
ll a[MAX],k[MAX], n, W;

ll solve(ll i, ll w)
{
	if(i>=n) return 0;

	if(dp[i][w]!=-1) return dp[i][w];

	ll p1=0,p2=0;

	if((k[i]+w)<=W)
		p1=solve(i+1, w+k[i])+a[i];
	else p1=0;

	p2=solve(i+1,w);

	return dp[i][w]=max(p1,p2);
}

int main()
{
	memset(dp,-1,sizeof dp);
	cin >> n >> W;
	for(int i=0;i<n;i++) cin >> k[i] >> a[i];

	cout << solve(0,0) << endl;
}


Measured memory_bytes: 79232
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, k, s;cin >> n >> k >> s;
  vector<int> hoge(n);
  for (int i = 0; i < k; i++){
    hoge[i] = s;
  }


  for (int i = k; i < n; i++){
    if(s == 1000000000){
      hoge[i] = 1000000000 - 1;
    }else{
      hoge[i] = s + 1;
    }
  }

  for (int i = 0; i < n; i++){
    if(i == n - 1){
      cout << hoge[i] << endl;
    }else{
      cout << hoge[i] << " ";
    }
  }
  // cout << 3 << " " << 3 << " " << 1 << " " << 1 << endl;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
using namespace std;
int main(){
	while (1){
		int N, A, B, C, x;
		cin >> N >> A >> B >> C >> x;
		if (N == 0 && A == 0 && B == 0 && C == 0 && x == 0)return 0;
		vector<int> Y(N);
		for (int i = 0; i < N; i++){
			cin >> Y[i];
		}
		int f = -1;
		for (int i = 0; i < N; i++){
			while (f <= 10000){
				if(f>=0)x = (x*A + B) % C;
				f++;
				if (x == Y[i])
					break;
			}
		}
		
		//cout << "res:";
		if (f>10000)
			cout << -1 << endl;
		else cout << f << endl;
		

	}


}

Measured memory_bytes: 1196
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    A, B = [], []
    for _ in range(N):
        A.append(input())
    for _ in range(M):
        B.append(input())

    for y in range(N - M + 1):
        for x in range(N - M + 1):
            ok = True
            for by in range(M):
                for bx in range(M):
                    if A[y + by][x + bx] != B[by][bx]:
                        ok = False
            if ok:
                print("Yes")
                return
    print("No")

if __name__ == '__main__':
    main()


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

int main() {
  int n; cin >> n;
  map<ll, int> m;
  ll s = 0;
  m[0] = 1;
  ll res = 0;
  while (n--) {
    int x; cin >> x;
    m[s+=x]++;
    res += m[s] - 1;
  }
  cout << res << endl;
}

Measured memory_bytes: 12800